Skip to content

Commit

Permalink
Add "Copy link" entry in sharing panel in sidebar
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
  • Loading branch information
PVince81 committed Nov 11, 2020
1 parent fd8d0ec commit 5a17b04
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/components/LinkShareSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@

<template>
<ul>
<ActionButton
icon="icon-clippy"
:close-after-click="true"
@click="handleCopyLink">
{{ t('spreed', 'Copy link') }}
</ActionButton>
<ActionCheckbox
:disabled="isSaving"
:checked="isSharedPublicly"
Expand Down Expand Up @@ -52,17 +58,20 @@

<script>
import { showError, showSuccess } from '@nextcloud/dialogs'
import { generateUrl } from '@nextcloud/router'
import { CONVERSATION } from '../constants'
import {
setConversationPassword,
} from '../services/conversationsService'
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
import ActionCheckbox from '@nextcloud/vue/dist/Components/ActionCheckbox'
import ActionInput from '@nextcloud/vue/dist/Components/ActionInput'
export default {
name: 'LinkShareSettings',
components: {
ActionButton,
ActionCheckbox,
ActionInput,
},
Expand Down Expand Up @@ -92,6 +101,15 @@ export default {
},
methods: {
async handleCopyLink() {
try {
await this.$copyText(window.location.protocol + '//' + window.location.host + generateUrl('/call/' + this.token))
showSuccess(t('spreed', 'Conversation link copied to clipboard.'))
} catch (error) {
showError(t('spreed', 'The link could not be copied.'))
}
},
async setConversationPassword(newPassword) {
this.isSaving = true
try {
Expand Down
2 changes: 1 addition & 1 deletion src/components/RightSidebar/RightSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
type="room"
:name="conversation.displayName" />
<LinkShareSettings
v-if="canFullModerate && showModerationOptions" />
v-if="token && canFullModerate && showModerationOptions" />
<div id="app-settings">
<div id="app-settings-header">
<button class="settings-button" @click="showSettings">
Expand Down

0 comments on commit 5a17b04

Please sign in to comment.