feat: Link to a message

This commit is contained in:
Pranav Raj S 2022-11-09 19:11:20 -08:00
parent 47c90e2085
commit ead7a5fc87
7 changed files with 78 additions and 13 deletions

View file

@ -47,6 +47,18 @@
</woot-button>
</woot-dropdown-item>
<woot-dropdown-item>
<woot-button
variant="clear"
size="small"
icon="link"
color-scheme="secondary"
@click="copyLinkToMessage"
>
Copy Permalink
</woot-button>
</woot-dropdown-item>
<woot-dropdown-item>
<woot-button
v-if="showCannedResponseOption"
@ -72,6 +84,8 @@ import AddCannedModal from 'dashboard/routes/dashboard/settings/canned/AddCanned
import WootDropdownItem from 'shared/components/ui/dropdown/DropdownItem';
import WootDropdownMenu from 'shared/components/ui/dropdown/DropdownMenu';
import { copyTextToClipboard } from 'shared/helpers/clipboard';
import { conversationUrl, frontendURL } from '../../../helper/URLHelper';
import { mapGetters } from 'vuex';
export default {
components: {
@ -101,11 +115,22 @@ export default {
type: Boolean,
default: true,
},
conversationId: {
type: Number,
required: true,
},
id: {
type: Number,
required: true,
},
},
data() {
return { isCannedResponseModalOpen: false };
},
computed: {
...mapGetters({
currentAccountId: 'getCurrentAccountId',
}),
plainTextContent() {
return this.getPlainText(this.messageContent);
},
@ -114,6 +139,19 @@ export default {
handleContextMenuClick() {
this.$emit('toggle', !this.isOpen);
},
async copyLinkToMessage() {
await copyTextToClipboard(
frontendURL(
conversationUrl({
id: this.conversationId,
accountId: this.currentAccountId,
}) +
'?messageId=' +
this.id
)
);
this.showAlert('Link Copied');
},
async handleCopy() {
await copyTextToClipboard(this.plainTextContent);
this.showAlert(this.$t('CONTACT_PANEL.COPY_SUCCESSFUL'));