diff options
author | Vincent Petry <vincent@nextcloud.com> | 2021-02-04 14:26:51 +0300 |
---|---|---|
committer | Vincent Petry <vincent@nextcloud.com> | 2021-02-12 17:18:05 +0300 |
commit | 2999b5d66559817e57f52be5e02f9cd859da8cc0 (patch) | |
tree | 7ed01fbef8b39691f579d30fe08392a0c331406b /src/mixins | |
parent | a5b115f943167732356abc4a946a93510915add0 (diff) |
Fix redirect when deleting current conversation
When the current conversation was deleted while in a call, or
whenever someone has been removed from a room, the redirect
now targets the not-found page instead of the one about duplicate
session.
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'src/mixins')
-rw-r--r-- | src/mixins/sessionIssueHandler.js (renamed from src/mixins/duplicateSessionHandler.js) | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/mixins/duplicateSessionHandler.js b/src/mixins/sessionIssueHandler.js index 604eccb23..7d3c487d6 100644 --- a/src/mixins/duplicateSessionHandler.js +++ b/src/mixins/sessionIssueHandler.js @@ -24,32 +24,42 @@ import { generateUrl } from '@nextcloud/router' import { EventBus } from '../services/EventBus' import SessionStorage from '../services/SessionStorage' -const talkHashCheck = { +const sessionIssueHandler = { data() { return { - isLeavingAfterSessionConflict: false, + isLeavingAfterSessionIssue: false, } }, beforeDestroy() { EventBus.$off('duplicateSessionDetected', this.duplicateSessionTriggered) + EventBus.$off('deletedSessionDetected', this.deletedSessionTriggered) }, beforeMount() { EventBus.$on('duplicateSessionDetected', this.duplicateSessionTriggered) + EventBus.$on('deletedSessionDetected', this.deletedSessionTriggered) }, methods: { duplicateSessionTriggered() { - this.isLeavingAfterSessionConflict = true + this.isLeavingAfterSessionIssue = true SessionStorage.removeItem('joined_conversation') + // Need to delay until next tick, otherwise the PreventUnload is still being triggered + // Putting the window in front with the warning and irritating the user this.$nextTick(() => { - // Need to delay until next tick, otherwise the PreventUnload is still being triggered - // Putting the window in front with the warning and irritating the user + // FIXME: can't use router push as it somehow doesn't clean up + // fully and leads the other instance where "Join here" was clicked + // to redirect to "not found" window.location = generateUrl('/apps/spreed/duplicate-session') }) }, + + deletedSessionTriggered() { + this.$router.push({ name: 'notfound', params: { skipLeaveWarning: true } }) + this.$store.dispatch('updateToken', '') + }, }, } -export default talkHashCheck +export default sessionIssueHandler |