Merge pull request #2772 from nextcloud/bugfix/2741/confirm-leaving-the-call

Confirm leaving the call
This commit is contained in:
Joas Schilling 2020-01-16 20:47:04 +01:00 коммит произвёл GitHub
Родитель 8ea681203e 527f1b6b5b
Коммит cc1409b429
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 24 добавлений и 6 удалений

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

@ -225,17 +225,14 @@ export default {
}
})
/**
* Global before guard, this is called whenever a navigation is triggered.
*/
Router.beforeEach((to, from, next) => {
const beforeRouteChangeListener = (to, from, next) => {
/**
* This runs whenever the new route is a conversation.
*/
if (to.name === 'conversation') {
// Page title
const NEXT_CONVERSATION_NAME = this.getConversationName(to.params.token)
this.setPageTitle(NEXT_CONVERSATION_NAME)
const nextConversationName = this.getConversationName(to.params.token)
this.setPageTitle(nextConversationName)
// Update current token in the token store
this.$store.dispatch('updateToken', to.params.token)
}
@ -246,6 +243,27 @@ export default {
EventBus.$emit('routeChange', { from, to })
next()
}
/**
* Global before guard, this is called whenever a navigation is triggered.
*/
Router.beforeEach((to, from, next) => {
if (this.isInCall) {
OC.dialogs.confirm(
t('spreed', 'Do you really want to leave the call?'),
t('spreed', 'Leaving call'),
(decision) => {
if (!decision) {
return
}
beforeRouteChangeListener(to, from, next)
}
)
} else {
beforeRouteChangeListener(to, from, next)
}
})
if (getCurrentUser()) {