From 8f05d42cd37e9cb9623aa4f346a8b6ec1e7de5da Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Mon, 19 Feb 2024 12:09:04 +0100 Subject: [PATCH] fix(MessageForwarder): use native browser navigation outside of Talk Signed-off-by: Maksim Sukharev --- .../MessageButtonsBar/MessageForwarder.vue | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/components/MessagesList/MessagesGroup/Message/MessageButtonsBar/MessageForwarder.vue b/src/components/MessagesList/MessagesGroup/Message/MessageButtonsBar/MessageForwarder.vue index dc787489edd..a9120215f36 100644 --- a/src/components/MessagesList/MessagesGroup/Message/MessageButtonsBar/MessageForwarder.vue +++ b/src/components/MessagesList/MessagesGroup/Message/MessageButtonsBar/MessageForwarder.vue @@ -59,6 +59,7 @@ import Check from 'vue-material-design-icons/Check.vue' import { showError } from '@nextcloud/dialogs' +import { generateUrl } from '@nextcloud/router' import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js' @@ -131,17 +132,26 @@ export default { }, openConversation() { + if (window.location.href.includes('/apps/files')) { + // Native redirect to Talk from Files sidebar + const url = generateUrl('/call/{token}#message_{messageId}', { + token: this.selectedConversationToken, + messageId: this.forwardedMessageID, + }) + window.open(url, '_blank').focus() + } else { + this.$router.push({ + name: 'conversation', + hash: `#message_${this.forwardedMessageID}`, + params: { + token: `${this.selectedConversationToken}`, + }, + }).catch(err => console.debug(`Error while pushing the new conversation's route: ${err}`)) + } - this.$router.push({ - name: 'conversation', - hash: `#message_${this.forwardedMessageID}`, - params: { - token: `${this.selectedConversationToken}`, - }, - }) - .catch(err => console.debug(`Error while pushing the new conversation's route: ${err}`)) this.showForwardedConfirmation = false this.forwardedMessageID = '' + this.$emit('close') }, handleClose() {