diff options
Diffstat (limited to 'apps/files_sharing/src/components/SharingInput.vue')
-rw-r--r-- | apps/files_sharing/src/components/SharingInput.vue | 52 |
1 files changed, 21 insertions, 31 deletions
diff --git a/apps/files_sharing/src/components/SharingInput.vue b/apps/files_sharing/src/components/SharingInput.vue index 66a6044f7c2..7a441865a78 100644 --- a/apps/files_sharing/src/components/SharingInput.vue +++ b/apps/files_sharing/src/components/SharingInput.vue @@ -38,8 +38,8 @@ import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js' import Config from '../services/ConfigService.ts' import Share from '../models/Share.ts' import ShareRequests from '../mixins/ShareRequests.js' -import ShareTypes from '../mixins/ShareTypes.js' import ShareDetails from '../mixins/ShareDetails.js' +import { ShareType } from '@nextcloud/sharing' export default { name: 'SharingInput', @@ -48,7 +48,7 @@ export default { NcSelect, }, - mixins: [ShareTypes, ShareRequests, ShareDetails], + mixins: [ShareRequests, ShareDetails], props: { shares: { @@ -168,20 +168,10 @@ export default { lookup = true } - const shareType = [ - this.SHARE_TYPES.SHARE_TYPE_USER, - this.SHARE_TYPES.SHARE_TYPE_GROUP, - this.SHARE_TYPES.SHARE_TYPE_REMOTE, - this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP, - this.SHARE_TYPES.SHARE_TYPE_CIRCLE, - this.SHARE_TYPES.SHARE_TYPE_ROOM, - this.SHARE_TYPES.SHARE_TYPE_GUEST, - this.SHARE_TYPES.SHARE_TYPE_DECK, - this.SHARE_TYPES.SHARE_TYPE_SCIENCEMESH, - ] + const shareType = Object.values(ShareType) if (getCapabilities().files_sharing.public.enabled === true) { - shareType.push(this.SHARE_TYPES.SHARE_TYPE_EMAIL) + shareType.push(ShareType.Email) } let request = null @@ -318,7 +308,7 @@ export default { return arr } try { - if (share.value.shareType === this.SHARE_TYPES.SHARE_TYPE_USER) { + if (share.value.shareType === ShareType.User) { // filter out current user if (share.value.shareWith === getCurrentUser().uid) { return arr @@ -331,7 +321,7 @@ export default { } // filter out existing mail shares - if (share.value.shareType === this.SHARE_TYPES.SHARE_TYPE_EMAIL) { + if (share.value.shareType === ShareType.Email) { const emails = this.linkShares.map(elem => elem.shareWith) if (emails.indexOf(share.value.shareWith.trim()) !== -1) { return arr @@ -369,42 +359,42 @@ export default { */ shareTypeToIcon(type) { switch (type) { - case this.SHARE_TYPES.SHARE_TYPE_GUEST: + case ShareType.Guest: // default is a user, other icons are here to differentiate // themselves from it, so let's not display the user icon - // case this.SHARE_TYPES.SHARE_TYPE_REMOTE: - // case this.SHARE_TYPES.SHARE_TYPE_USER: + // case ShareType.Remote: + // case ShareType.User: return { icon: 'icon-user', iconTitle: t('files_sharing', 'Guest'), } - case this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP: - case this.SHARE_TYPES.SHARE_TYPE_GROUP: + case ShareType.RemoteGroup: + case ShareType.Group: return { icon: 'icon-group', iconTitle: t('files_sharing', 'Group'), } - case this.SHARE_TYPES.SHARE_TYPE_EMAIL: + case ShareType.Email: return { icon: 'icon-mail', iconTitle: t('files_sharing', 'Email'), } - case this.SHARE_TYPES.SHARE_TYPE_CIRCLE: + case ShareType.Team: return { icon: 'icon-teams', iconTitle: t('files_sharing', 'Team'), } - case this.SHARE_TYPES.SHARE_TYPE_ROOM: + case ShareType.Room: return { icon: 'icon-room', iconTitle: t('files_sharing', 'Talk conversation'), } - case this.SHARE_TYPES.SHARE_TYPE_DECK: + case ShareType.Deck: return { icon: 'icon-deck', iconTitle: t('files_sharing', 'Deck board'), } - case this.SHARE_TYPES.SHARE_TYPE_SCIENCEMESH: + case ShareType.Sciencemesh: return { icon: 'icon-sciencemesh', iconTitle: t('files_sharing', 'ScienceMesh'), @@ -422,13 +412,13 @@ export default { */ formatForMultiselect(result) { let subname - if (result.value.shareType === this.SHARE_TYPES.SHARE_TYPE_USER && this.config.shouldAlwaysShowUnique) { + if (result.value.shareType === ShareType.User && this.config.shouldAlwaysShowUnique) { subname = result.shareWithDisplayNameUnique ?? '' - } else if ((result.value.shareType === this.SHARE_TYPES.SHARE_TYPE_REMOTE - || result.value.shareType === this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP + } else if ((result.value.shareType === ShareType.Remote + || result.value.shareType === ShareType.RemoteGroup ) && result.value.server) { subname = t('files_sharing', 'on {server}', { server: result.value.server }) - } else if (result.value.shareType === this.SHARE_TYPES.SHARE_TYPE_EMAIL) { + } else if (result.value.shareType === ShareType.Email) { subname = result.value.shareWith } else { subname = result.shareWithDescription ?? '' @@ -438,7 +428,7 @@ export default { shareWith: result.value.shareWith, shareType: result.value.shareType, user: result.uuid || result.value.shareWith, - isNoUser: result.value.shareType !== this.SHARE_TYPES.SHARE_TYPE_USER, + isNoUser: result.value.shareType !== ShareType.User, displayName: result.name || result.label, subname, shareWithDisplayNameUnique: result.shareWithDisplayNameUnique || '', |