Commit 8c5946b7 authored by feld's avatar feld

Add button in 3dot menu to copy status link to clipboard

parent 6e14fb29
Pipeline #24037 passed with stages
in 7 minutes and 12 seconds
...@@ -3,6 +3,11 @@ import Popover from '../popover/popover.vue' ...@@ -3,6 +3,11 @@ import Popover from '../popover/popover.vue'
const ExtraButtons = { const ExtraButtons = {
props: [ 'status' ], props: [ 'status' ],
components: { Popover }, components: { Popover },
data: function () {
return {
statusLink: `https://${this.$store.state.instance.name}${this.$router.resolve({ name: 'conversation', params: { id: this.status.id } }).href}`
}
},
methods: { methods: {
deleteStatus () { deleteStatus () {
const confirmed = window.confirm(this.$t('status.delete_confirm')) const confirmed = window.confirm(this.$t('status.delete_confirm'))
...@@ -29,6 +34,11 @@ const ExtraButtons = { ...@@ -29,6 +34,11 @@ const ExtraButtons = {
this.$store.dispatch('unmuteConversation', this.status.id) this.$store.dispatch('unmuteConversation', this.status.id)
.then(() => this.$emit('onSuccess')) .then(() => this.$emit('onSuccess'))
.catch(err => this.$emit('onError', err.error.error)) .catch(err => this.$emit('onError', err.error.error))
},
copyLink () {
navigator.clipboard.writeText(this.statusLink)
.then(() => this.$emit('onSuccess'))
.catch(err => this.$emit('onError', err.error.error))
} }
}, },
computed: { computed: {
......
<template> <template>
<Popover <Popover
v-if="canDelete || canMute || canPin"
trigger="click" trigger="click"
placement="top" placement="top"
class="extra-button-popover" class="extra-button-popover"
...@@ -45,6 +44,13 @@ ...@@ -45,6 +44,13 @@
> >
<i class="icon-cancel" /><span>{{ $t("status.delete") }}</span> <i class="icon-cancel" /><span>{{ $t("status.delete") }}</span>
</button> </button>
<button
v-close-popover
class="dropdown-item dropdown-item-icon"
@click.prevent="copyLink"
>
<i class="icon-share" /><span>{{ $t("status.copy_link") }}</span>
</button>
</div> </div>
</div> </div>
<i <i
......
...@@ -616,7 +616,8 @@ ...@@ -616,7 +616,8 @@
"replies_list": "Replies:", "replies_list": "Replies:",
"mute_conversation": "Mute conversation", "mute_conversation": "Mute conversation",
"unmute_conversation": "Unmute conversation", "unmute_conversation": "Unmute conversation",
"status_unavailable": "Status unavailable" "status_unavailable": "Status unavailable",
"copy_link": "Copy link to status"
}, },
"user_card": { "user_card": {
"approve": "Approve", "approve": "Approve",
......
...@@ -345,6 +345,12 @@ ...@@ -345,6 +345,12 @@
"css": "link", "css": "link",
"code": 59427, "code": 59427,
"src": "fontawesome" "src": "fontawesome"
},
{
"uid": "4aad6bb50b02c18508aae9cbe14e784e",
"css": "share",
"code": 61920,
"src": "fontawesome"
} }
] ]
} }
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment