From 157e1751be3e571c961e0e28d1141f1b33473c18 Mon Sep 17 00:00:00 2001 From: DorraJaouad Date: Fri, 30 Aug 2024 11:28:47 +0200 Subject: [PATCH 1/2] fix: refactor connection failed description Signed-off-by: DorraJaouad --- .../CallView/shared/EmptyCallView.vue | 24 ++++++++++++------- src/store/participantsStore.js | 2 +- src/utils/signaling.js | 4 ++-- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/components/CallView/shared/EmptyCallView.vue b/src/components/CallView/shared/EmptyCallView.vue index c7451907cc7..7e258ffeeda 100644 --- a/src/components/CallView/shared/EmptyCallView.vue +++ b/src/components/CallView/shared/EmptyCallView.vue @@ -35,6 +35,13 @@ import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' import { CONVERSATION, PARTICIPANT } from '../../../constants.js' import { copyConversationLinkToClipboard } from '../../../utils/handleUrl.ts' +const STATUS_ERRORS = { + 400: t('spreed', 'Recording consent is required'), + 403: t('spreed', 'This conversation is read-only'), + 404: t('spreed', 'Conversation not found or not joined'), + 412: t('spreed', "Lobby is still active and you're not a moderator"), +} + export default { name: 'EmptyCallView', @@ -148,18 +155,19 @@ export default { }, helper() { - if (this.connectionFailed) { - return t('spreed', 'Please try to reload the page') - } - return '' + return this.connectionFailed ? t('spreed', 'Please try to reload the page') : '' }, message() { - if (this.connectionFailed === 'consent') { - return t('spreed', 'Recording consent is required') - } - if (this.connectionFailed) { + const statusCode = this.connectionFailed?.meta?.statuscode + if (STATUS_ERRORS[statusCode]) { + return STATUS_ERRORS[statusCode] + } + if (this.connectionFailed?.data?.error) { + return this.connectionFailed.data.error + } + return t('spreed', 'Something went wrong') } diff --git a/src/store/participantsStore.js b/src/store/participantsStore.js index 308ea0b4102..0ac2fe0a581 100644 --- a/src/store/participantsStore.js +++ b/src/store/participantsStore.js @@ -339,7 +339,7 @@ const mutations = { }, connectionFailed(state, { token, payload }) { - Vue.set(state.connectionFailed, token, payload ?? 'failed') + Vue.set(state.connectionFailed, token, payload) }, finishedConnecting(state, { token, sessionId }) { diff --git a/src/utils/signaling.js b/src/utils/signaling.js index d476647e3c2..ee3ce49b6ea 100644 --- a/src/utils/signaling.js +++ b/src/utils/signaling.js @@ -280,10 +280,10 @@ Signaling.Base.prototype.joinCall = function(token, flags, silent, recordingCons }.bind(this)) .catch(function(e) { reject(new Error()) - console.error('Connection failed, reason: ', e.response?.data?.ocs?.data?.error) + console.error('Connection failed, reason: ', e) store.commit('connectionFailed', { token, - payload: e.response?.data?.ocs?.data?.error, + payload: e.response?.data?.ocs, }) }) }) From 4cdab82315d4f50ebdede58b5b7f0182e39ef05a Mon Sep 17 00:00:00 2001 From: DorraJaouad Date: Fri, 30 Aug 2024 13:52:01 +0200 Subject: [PATCH 2/2] fix(EmptyCallView): migrate from icon classes Signed-off-by: DorraJaouad --- .../CallView/shared/EmptyCallView.vue | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/components/CallView/shared/EmptyCallView.vue b/src/components/CallView/shared/EmptyCallView.vue index 7e258ffeeda..7fc355063d7 100644 --- a/src/components/CallView/shared/EmptyCallView.vue +++ b/src/components/CallView/shared/EmptyCallView.vue @@ -8,8 +8,9 @@ :class="{ 'empty-call-view--sidebar': isSidebar, 'empty-call-view--small': isSmall - }"> -
+ }" + data-theme-dark> +

{{ title }}