Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable26] fix(Forwarder): fix redirect from sidebar #11611

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<template>
<div class="forwarder">
<NcEmptyContent :description="t('spreed', 'The message has been forwarded to {selectedConversationName}')">
<NcEmptyContent :description="description">
<template #icon>
<Check :size="64" />
</template>
Expand Down Expand Up @@ -50,7 +50,7 @@
<NcModal v-else
:container="container"
@close="handleClose">
<NcEmptyContent :description="t('spreed', 'The message has been forwarded to {selectedConversationName}', { selectedConversationName })">
<NcEmptyContent :description="description">
<template #icon>
<Check :size="64" />
</template>
Expand All @@ -73,6 +73,7 @@ import cloneDeep from 'lodash/cloneDeep.js'
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'
Expand Down Expand Up @@ -123,7 +124,15 @@ export default {
},

selectedConversationName() {
return this.$store.getters?.conversation(this.selectedConversationToken).displayName
return this.$store.getters?.conversation(this.selectedConversationToken)?.displayName
},

description() {
return this.selectedConversationName
? t('spreed', 'The message has been forwarded to {selectedConversationName}',
{ selectedConversationName: this.selectedConversationName },
)
: t('spreed', 'The message has been forwarded')
},

/**
Expand Down Expand Up @@ -193,17 +202,28 @@ export default {
},

openConversation() {
const isTalkApp = IS_DESKTOP || window.location.pathname.includes('/apps/spreed') || window.location.pathname.includes('/call/')

if (!isTalkApp) {
// 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() {
Expand Down
Loading