diff options
Diffstat (limited to 'apps/files_sharing/src/components/SharingEntry.vue')
-rw-r--r-- | apps/files_sharing/src/components/SharingEntry.vue | 92 |
1 files changed, 42 insertions, 50 deletions
diff --git a/apps/files_sharing/src/components/SharingEntry.vue b/apps/files_sharing/src/components/SharingEntry.vue index 84525fa2f0c..342b40ce384 100644 --- a/apps/files_sharing/src/components/SharingEntry.vue +++ b/apps/files_sharing/src/components/SharingEntry.vue @@ -1,54 +1,40 @@ <!-- - - @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com> - - - - @author John Molakvoæ <skjnldsv@protonmail.com> - - - - @license GNU AGPL version 3 or any later version - - - - This program is free software: you can redistribute it and/or modify - - it under the terms of the GNU Affero General Public License as - - published by the Free Software Foundation, either version 3 of the - - License, or (at your option) any later version. - - - - This program is distributed in the hope that it will be useful, - - but WITHOUT ANY WARRANTY; without even the implied warranty of - - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - - GNU Affero General Public License for more details. - - - - You should have received a copy of the GNU Affero General Public License - - along with this program. If not, see <http://www.gnu.org/licenses/>. - - - --> + - SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors + - SPDX-License-Identifier: AGPL-3.0-or-later +--> <template> <li class="sharing-entry"> <NcAvatar class="sharing-entry__avatar" - :is-no-user="share.type !== SHARE_TYPES.SHARE_TYPE_USER" + :is-no-user="share.type !== ShareType.User" :user="share.shareWith" :display-name="share.shareWithDisplayName" :menu-position="'left'" :url="share.shareWithAvatar" /> - <div class="sharing-entry__summary" @click.prevent="toggleQuickShareSelect"> + <div class="sharing-entry__summary"> <component :is="share.shareWithLink ? 'a' : 'div'" :title="tooltip" :aria-label="tooltip" :href="share.shareWithLink" class="sharing-entry__summary__desc"> <span>{{ title }} - <span v-if="!isUnique" class="sharing-entry__summary__desc-unique"> ({{ - share.shareWithDisplayNameUnique }})</span> + <span v-if="!isUnique" class="sharing-entry__summary__desc-unique"> + ({{ share.shareWithDisplayNameUnique }}) + </span> <small v-if="hasStatus && share.status.message">({{ share.status.message }})</small> </span> </component> - <QuickShareSelect :share="share" + <SharingEntryQuickShareSelect :share="share" :file-info="fileInfo" - :toggle="showDropdown" @open-sharing-details="openShareDetailsForCustomSettings(share)" /> </div> - <NcButton class="sharing-entry__action" + <ShareExpiryTime v-if="share && share.expireDate" :share="share" /> + <NcButton v-if="share.canEdit" + class="sharing-entry__action" + data-cy-files-sharing-share-actions :aria-label="t('files_sharing', 'Open Sharing Details')" - type="tertiary-no-background" + type="tertiary" @click="openSharingDetails(share)"> <template #icon> <DotsHorizontalIcon :size="20" /> @@ -58,12 +44,15 @@ </template> <script> -import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' -import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js' -import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js' +import { ShareType } from '@nextcloud/sharing' + +import NcButton from '@nextcloud/vue/components/NcButton' +import NcSelect from '@nextcloud/vue/components/NcSelect' +import NcAvatar from '@nextcloud/vue/components/NcAvatar' import DotsHorizontalIcon from 'vue-material-design-icons/DotsHorizontal.vue' -import QuickShareSelect from './SharingEntryQuickShareSelect.vue' +import ShareExpiryTime from './ShareExpiryTime.vue' +import SharingEntryQuickShareSelect from './SharingEntryQuickShareSelect.vue' import SharesMixin from '../mixins/SharesMixin.js' import ShareDetails from '../mixins/ShareDetails.js' @@ -76,30 +65,35 @@ export default { NcAvatar, DotsHorizontalIcon, NcSelect, - QuickShareSelect, + ShareExpiryTime, + SharingEntryQuickShareSelect, }, mixins: [SharesMixin, ShareDetails], - data() { - return { - showDropdown: false, - } - }, computed: { title() { let title = this.share.shareWithDisplayName - if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_GROUP) { + + const showAsInternal = this.config.showFederatedSharesAsInternal + || (this.share.isTrustedServer && this.config.showFederatedSharesToTrustedServersAsInternal) + + if (this.share.type === ShareType.Group || (this.share.type === ShareType.RemoteGroup && showAsInternal)) { title += ` (${t('files_sharing', 'group')})` - } else if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_ROOM) { + } else if (this.share.type === ShareType.Room) { title += ` (${t('files_sharing', 'conversation')})` - } else if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_REMOTE) { + } else if (this.share.type === ShareType.Remote && !showAsInternal) { title += ` (${t('files_sharing', 'remote')})` - } else if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP) { + } else if (this.share.type === ShareType.RemoteGroup) { title += ` (${t('files_sharing', 'remote group')})` - } else if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_GUEST) { + } else if (this.share.type === ShareType.Guest) { title += ` (${t('files_sharing', 'guest')})` } + if (!this.isShareOwner && this.share.ownerDisplayName) { + title += ' ' + t('files_sharing', 'by {initiator}', { + initiator: this.share.ownerDisplayName, + }) + } return title }, tooltip() { @@ -110,9 +104,9 @@ export default { user: this.share.shareWithDisplayName, owner: this.share.ownerDisplayName, } - if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_GROUP) { + if (this.share.type === ShareType.Group) { return t('files_sharing', 'Shared with the group {user} by {owner}', data) - } else if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_ROOM) { + } else if (this.share.type === ShareType.Room) { return t('files_sharing', 'Shared with the conversation {user} by {owner}', data) } @@ -125,7 +119,7 @@ export default { * @return {boolean} */ hasStatus() { - if (this.share.type !== this.SHARE_TYPES.SHARE_TYPE_USER) { + if (this.share.type !== ShareType.User) { return false } @@ -140,9 +134,6 @@ export default { onMenuClose() { this.onNoteSubmit() }, - toggleQuickShareSelect() { - this.showDropdown = !this.showDropdown - }, }, } </script> @@ -154,10 +145,11 @@ export default { height: 44px; &__summary { padding: 8px; - padding-left: 10px; + padding-inline-start: 10px; display: flex; flex-direction: column; justify-content: center; + align-items: flex-start; flex: 1 0; min-width: 0; |