Skip to content

Commit

Permalink
Merge pull request #11611 from nextcloud/backport/11609/stable26
Browse files Browse the repository at this point in the history
[stable26] fix(Forwarder): fix redirect from sidebar
  • Loading branch information
nickvergessen authored Feb 22, 2024
2 parents 9f41a6e + 6695f5a commit 321aa2b
Showing 1 changed file with 31 additions and 11 deletions.
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

0 comments on commit 321aa2b

Please sign in to comment.