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

copy msg link to clipboard #5285

Merged
merged 3 commits into from
Mar 8, 2021
Merged
Changes from 2 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
37 changes: 30 additions & 7 deletions src/components/MessagesList/MessagesGroup/Message/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ the main body of the message as well as a quote.
@click.stop="handlePrivateReply">
{{ t('spreed', 'Reply privately') }}
</ActionButton>
<ActionButton
v-if="!isSystemMessage"
icon="icon-external"
:close-after-click="true"
@click.stop.prevent="handleCopyMessageLink">
{{ t('spreed', 'Copy message link') }}
</ActionButton>
<ActionSeparator v-if="messageActions.length > 0" />
<template
v-for="action in messageActions">
<ActionButton
Expand All @@ -144,13 +152,15 @@ the main body of the message as well as a quote.
{{ action.label }}
</ActionButton>
</template>
<ActionButton
v-if="isDeleteable"
icon="icon-delete"
:close-after-click="true"
@click.stop="handleDelete">
{{ t('spreed', 'Delete') }}
</ActionButton>
<template v-if="isDeleteable">
<ActionSeparator />
jakobroehrl marked this conversation as resolved.
Show resolved Hide resolved
<ActionButton
icon="icon-delete"
:close-after-click="true"
@click.stop="handleDelete">
{{ t('spreed', 'Delete') }}
</ActionButton>
</template>
</Actions>
</div>
</div>
Expand All @@ -161,6 +171,7 @@ the main body of the message as well as a quote.
<script>
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
import Actions from '@nextcloud/vue/dist/Components/Actions'
import ActionSeparator from '@nextcloud/vue/dist/Components/ActionSeparator'
import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip'
import CallButton from '../../../TopBar/CallButton'
import DeckCard from './MessagePart/DeckCard'
Expand All @@ -185,6 +196,7 @@ import {
TOAST_DEFAULT_TIMEOUT,
} from '@nextcloud/dialogs'
import { createOneToOneConversation } from '../../../../services/conversationsService'
import { generateUrl } from '@nextcloud/router'

export default {
name: 'Message',
Expand All @@ -203,6 +215,7 @@ export default {
Check,
CheckAll,
Reload,
ActionSeparator,
},

mixins: [
Expand Down Expand Up @@ -634,6 +647,16 @@ export default {
this.$store.dispatch('addConversation', conversation)
this.$router.push({ name: 'conversation', params: { token: conversation.token } }).catch(err => console.debug(`Error while pushing the new conversation's route: ${err}`))
},

async handleCopyMessageLink() {
try {
const link = window.location.protocol + '//' + window.location.host + generateUrl('/call/' + this.token) + '#message_' + this.id
await this.$copyText(link)
showSuccess(t('spreed', 'Message link copied to clipboard.'))
} catch (error) {
showError(t('spreed', 'The link could not be copied.'))
}
},
},
}
</script>
Expand Down