Show message when trying to leave as last moderator

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2019-11-22 15:15:11 +01:00
Родитель 1e5ac86457
Коммит 8bae5eb250
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7076EA9751AACDDA
2 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -217,7 +217,11 @@ export default {
// If successful, deletes the conversation from the store // If successful, deletes the conversation from the store
this.$store.dispatch('deleteConversation', this.item) this.$store.dispatch('deleteConversation', this.item)
} catch (error) { } catch (error) {
console.debug(`error while removing yourself from conversation ${error}`) if (error.response.status === 400) {
OCP.Toast.error(t('spreed', 'You need to promote a new moderator before you can leave the conversation.'))
} else {
console.debug(`error while removing yourself from conversation ${error}`)
}
} }
}, },
async toggleFavoriteConversation() { async toggleFavoriteConversation() {

Просмотреть файл

@ -72,12 +72,8 @@ const addParticipant = async function(token, newParticipant, source) {
* @param {string} token The conversation token; * @param {string} token The conversation token;
*/ */
const removeCurrentUserFromConversation = async function(token) { const removeCurrentUserFromConversation = async function(token) {
try { const response = await axios.delete(generateOcsUrl('apps/spreed/api/v1', 2) + `room/${token}/participants/self`)
const response = await axios.delete(generateOcsUrl('apps/spreed/api/v1', 2) + `room/${token}/participants/self`) return response
return response
} catch (error) {
console.debug(error)
}
} }
const removeUserFromConversation = async function(token, userId) { const removeUserFromConversation = async function(token, userId) {