Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-04-16 17:24:44 +0300
committerJoas Schilling <coding@schilljs.com>2020-07-01 11:00:23 +0300
commit61134a0752c30b175d246be0d698f99998f41f86 (patch)
treef739b1f2c20096c1559df89b831a297ee86fedf8 /src/utils/signaling.js
parentee2632ba40c4885ec477e8b02e4c038620eb5960 (diff)
Handle duplicated sessions more gracefully with the internal signaling
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'src/utils/signaling.js')
-rw-r--r--src/utils/signaling.js30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/utils/signaling.js b/src/utils/signaling.js
index 24a3a4845..58c8a5f4a 100644
--- a/src/utils/signaling.js
+++ b/src/utils/signaling.js
@@ -31,11 +31,15 @@ import { rejoinConversation } from '../services/participantsService'
import CancelableRequest from './cancelableRequest'
import { EventBus } from '../services/EventBus'
import axios from '@nextcloud/axios'
-import { generateOcsUrl, generateUrl } from '@nextcloud/router'
+import {
+ generateOcsUrl,
+ generateUrl,
+} from '@nextcloud/router'
import {
showError,
showWarning,
} from '@nextcloud/dialogs'
+import SessionStorage from '../services/SessionStorage'
const Signaling = {
Base: {},
@@ -431,6 +435,30 @@ Signaling.Internal.prototype._startPullingMessages = function() {
// User navigated away in the meantime. Ignore
} else if (axios.isCancel(error)) {
console.debug('Pulling messages request was cancelled')
+ } else if (error.response && error.response.status === 409) {
+ console.error('Session was killed but the conversation still exists')
+ this._trigger('pullMessagesStoppedOnFail')
+
+ OC.dialogs.confirmDestructive(
+ t('spreed', 'You joined the conversation in another window or device. This is currently not supported by Nextcloud Talk. What do you want to do?'),
+ t('spreed', 'Duplicate session'),
+ {
+ type: OC.dialogs.YES_NO_BUTTONS,
+ confirm: t('spreed', 'Restart here'),
+ confirmClasses: 'error',
+ cancel: t('spreed', 'Leave this page'),
+ },
+ decision => {
+ if (!decision) {
+ // Cancel
+ SessionStorage.removeItem('joined_conversation')
+ window.location = generateUrl('/apps/spreed')
+ } else {
+ // Confirm
+ window.location = generateUrl('call/' + token)
+ }
+ }
+ )
} else if (error.response && (error.response.status === 404 || error.response.status === 403)) {
console.error('Stop pulling messages because room does not exist or is not accessible')
this._trigger('pullMessagesStoppedOnFail')