feat: Allow agents/admins to copy the link to a message (#5912)
This commit is contained in:
@@ -62,7 +62,15 @@
|
||||
variant="icon"
|
||||
@click="handleTranslate"
|
||||
/>
|
||||
<hr v-if="enabledOptions['cannedResponse']" />
|
||||
<hr />
|
||||
<menu-item
|
||||
:option="{
|
||||
icon: 'link',
|
||||
label: this.$t('CONVERSATION.CONTEXT_MENU.COPY_PERMALINK'),
|
||||
}"
|
||||
variant="icon"
|
||||
@click="copyLinkToMessage"
|
||||
/>
|
||||
<menu-item
|
||||
v-if="enabledOptions['cannedResponse']"
|
||||
:option="{
|
||||
@@ -95,6 +103,7 @@ import { mixin as clickaway } from 'vue-clickaway';
|
||||
import messageFormatterMixin from 'shared/mixins/messageFormatterMixin';
|
||||
import AddCannedModal from 'dashboard/routes/dashboard/settings/canned/AddCanned';
|
||||
import { copyTextToClipboard } from 'shared/helpers/clipboard';
|
||||
import { conversationUrl, frontendURL } from '../../../helper/URLHelper';
|
||||
import { ACCOUNT_EVENTS } from '../../../helper/AnalyticsHelper/events';
|
||||
import TranslateModal from 'dashboard/components/widgets/conversation/bubble/TranslateModal';
|
||||
import MenuItem from '../../../components/widgets/conversation/contextMenu/menuItem.vue';
|
||||
@@ -153,6 +162,21 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
async copyLinkToMessage() {
|
||||
const fullConversationURL =
|
||||
window.chatwootConfig.hostURL +
|
||||
frontendURL(
|
||||
conversationUrl({
|
||||
id: this.conversationId,
|
||||
accountId: this.currentAccountId,
|
||||
})
|
||||
);
|
||||
await copyTextToClipboard(
|
||||
`${fullConversationURL}?messageId=${this.messageId}`
|
||||
);
|
||||
this.showAlert(this.$t('CONVERSATION.CONTEXT_MENU.LINK_COPIED'));
|
||||
this.handleClose();
|
||||
},
|
||||
async handleCopy() {
|
||||
await copyTextToClipboard(this.plainTextContent);
|
||||
this.showAlert(this.$t('CONTACT_PANEL.COPY_SUCCESSFUL'));
|
||||
|
||||
+12
-1
@@ -60,10 +60,21 @@ export default {
|
||||
type: [String, Date, Number],
|
||||
default: '',
|
||||
},
|
||||
messageId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
navigateTo() {
|
||||
return frontendURL(`accounts/${this.accountId}/conversations/${this.id}`);
|
||||
const params = {};
|
||||
if (this.messageId) {
|
||||
params.messageId = this.messageId;
|
||||
}
|
||||
return frontendURL(
|
||||
`accounts/${this.accountId}/conversations/${this.id}`,
|
||||
params
|
||||
);
|
||||
},
|
||||
createdAtTime() {
|
||||
return this.dynamicTime(this.createdAt);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
:account-id="accountId"
|
||||
:inbox="message.inbox"
|
||||
:created-at="message.created_at"
|
||||
:message-id="message.id"
|
||||
>
|
||||
<message-content
|
||||
:author="getName(message)"
|
||||
|
||||
Reference in New Issue
Block a user