-
Notifications
You must be signed in to change notification settings - Fork 448
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Call): Stop switching to CallView without a successful join. Int…
…roduce a failed join message dialog. Signed-off-by: DorraJaouad <[email protected]>
- Loading branch information
1 parent
c11ba79
commit 3d9adf5
Showing
3 changed files
with
95 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<!-- | ||
- SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
- SPDX-License-Identifier: AGPL-3.0-or-later | ||
--> | ||
|
||
<script setup lang="ts"> | ||
import { computed } from 'vue' | ||
|
||
import IconAlertOctagon from 'vue-material-design-icons/AlertOctagon.vue' | ||
|
||
import { t } from '@nextcloud/l10n' | ||
|
||
import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js' | ||
import NcModal from '@nextcloud/vue/dist/Components/NcModal.js' | ||
|
||
import { useStore } from '../../composables/useStore.js' | ||
|
||
const store = useStore() | ||
|
||
const props = defineProps({ | ||
token: { | ||
type: String, | ||
required: true, | ||
}, | ||
}) | ||
|
||
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"), | ||
} | ||
const userId = computed(() => store.getters.userId) | ||
const connectionFailed = computed(() => store.getters.connectionFailed(props.token)) | ||
const connectionFailedDialogId = `connection-failed-${userId.value}` | ||
const message = computed(() => { | ||
if (connectionFailed.value) { | ||
const statusCode = connectionFailed.value?.meta?.statuscode | ||
if (STATUS_ERRORS[statusCode]) { | ||
return STATUS_ERRORS[statusCode] | ||
} | ||
if (connectionFailed.value?.data?.error) { | ||
return connectionFailed.value.data.error | ||
} | ||
|
||
return t('spreed', 'Please try to reload the page') | ||
} else { | ||
return '' | ||
} | ||
}) | ||
|
||
/** | ||
* | ||
*/ | ||
function clearConnectionFailedError() { | ||
store.dispatch('clearConnectionFailed', props.token) | ||
} | ||
|
||
</script> | ||
|
||
<template> | ||
<NcModal class="connection-failed__modal" | ||
:label-id="connectionFailedDialogId" | ||
@close="clearConnectionFailedError"> | ||
<NcEmptyContent :name="t('spreed', 'Connection failed')" | ||
:description="message"> | ||
<template #icon> | ||
<IconAlertOctagon /> | ||
</template> | ||
</NcEmptyContent> | ||
</NcModal> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters