aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornfebe <fenn25.fn@gmail.com>2024-11-18 17:34:55 +0100
committernfebe <fenn25.fn@gmail.com>2024-12-03 14:25:15 +0100
commitd6efc531f6999b90330ec62869261be97dbe823f (patch)
treea2e0982af1312950cd88eaf7c3a8a3eada40c857
parentf1754ee2e1a3c977d05d31c61adb195b9f50fee8 (diff)
downloadnextcloud-server-d6efc531f6999b90330ec62869261be97dbe823f.tar.gz
nextcloud-server-d6efc531f6999b90330ec62869261be97dbe823f.zip
refactor: Use new `ShareType` across file_sharing
Signed-off-by: nfebe <fenn25.fn@gmail.com>
-rw-r--r--apps/dav/src/components/AbsenceForm.vue2
-rw-r--r--apps/files_sharing/src/components/FileListFilterAccount.vue2
-rw-r--r--apps/files_sharing/src/components/SharingEntry.vue20
-rw-r--r--apps/files_sharing/src/components/SharingEntryLink.vue2
-rw-r--r--apps/files_sharing/src/components/SharingEntryQuickShareSelect.vue6
-rw-r--r--apps/files_sharing/src/components/SharingInput.vue52
-rw-r--r--apps/files_sharing/src/mixins/ShareTypes.js14
-rw-r--r--apps/files_sharing/src/mixins/SharesMixin.js9
-rw-r--r--apps/files_sharing/src/services/ExternalShareActions.js2
-rw-r--r--apps/files_sharing/src/share.js26
-rw-r--r--apps/files_sharing/src/sharebreadcrumbview.js4
-rw-r--r--apps/files_sharing/src/utils/NodeShareUtils.ts10
-rw-r--r--apps/files_sharing/src/utils/SharedWithMe.js8
-rw-r--r--apps/files_sharing/src/views/SharingDetailsTab.vue55
-rw-r--r--apps/files_sharing/src/views/SharingLinkList.vue7
-rw-r--r--apps/files_sharing/src/views/SharingList.vue6
-rw-r--r--apps/files_sharing/src/views/SharingTab.vue16
-rw-r--r--package-lock.json9
-rw-r--r--package.json4
19 files changed, 114 insertions, 140 deletions
diff --git a/apps/dav/src/components/AbsenceForm.vue b/apps/dav/src/components/AbsenceForm.vue
index 2f78ac3ab79..2e2dff8551e 100644
--- a/apps/dav/src/components/AbsenceForm.vue
+++ b/apps/dav/src/components/AbsenceForm.vue
@@ -141,7 +141,7 @@ export default {
async getSuggestions(search) {
const shareType = [
- ShareType.SHARE_TYPE_USER,
+ ShareType.User,
]
let request = null
diff --git a/apps/files_sharing/src/components/FileListFilterAccount.vue b/apps/files_sharing/src/components/FileListFilterAccount.vue
index 9d69d70fa3f..89cedbf1ed8 100644
--- a/apps/files_sharing/src/components/FileListFilterAccount.vue
+++ b/apps/files_sharing/src/components/FileListFilterAccount.vue
@@ -39,6 +39,7 @@
import type { IAccountData } from '../filters/AccountFilter.ts'
import { translate as t } from '@nextcloud/l10n'
+import { ShareType } from '@nextcloud/sharing'
import { mdiAccountMultiple } from '@mdi/js'
import { useBrowserLocation } from '@vueuse/core'
import { computed, ref, watch } from 'vue'
@@ -49,7 +50,6 @@ import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
import NcActionInput from '@nextcloud/vue/dist/Components/NcActionInput.js'
import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'
import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js'
-import { ShareType } from '@nextcloud/sharing'
interface IUserSelectData {
id: string
diff --git a/apps/files_sharing/src/components/SharingEntry.vue b/apps/files_sharing/src/components/SharingEntry.vue
index 7af7354efba..a03ffab9fa1 100644
--- a/apps/files_sharing/src/components/SharingEntry.vue
+++ b/apps/files_sharing/src/components/SharingEntry.vue
@@ -6,7 +6,7 @@
<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'"
@@ -41,6 +41,8 @@
</template>
<script>
+import { ShareType } from '@nextcloud/sharing'
+
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'
@@ -67,15 +69,15 @@ export default {
computed: {
title() {
let title = this.share.shareWithDisplayName
- if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_GROUP) {
+ if (this.share.type === ShareType.Group) {
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) {
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) {
@@ -93,9 +95,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)
}
@@ -108,7 +110,7 @@ export default {
* @return {boolean}
*/
hasStatus() {
- if (this.share.type !== this.SHARE_TYPES.SHARE_TYPE_USER) {
+ if (this.share.type !== ShareType.User) {
return false
}
diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue
index c077c467545..7986d7e53ed 100644
--- a/apps/files_sharing/src/components/SharingEntryLink.vue
+++ b/apps/files_sharing/src/components/SharingEntryLink.vue
@@ -446,7 +446,7 @@ export default {
*/
isEmailShareType() {
return this.share
- ? this.share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL
+ ? this.share.type === ShareType.Email
: false
},
diff --git a/apps/files_sharing/src/components/SharingEntryQuickShareSelect.vue b/apps/files_sharing/src/components/SharingEntryQuickShareSelect.vue
index f0c2c4f3812..8bb982326ff 100644
--- a/apps/files_sharing/src/components/SharingEntryQuickShareSelect.vue
+++ b/apps/files_sharing/src/components/SharingEntryQuickShareSelect.vue
@@ -27,10 +27,10 @@
</template>
<script>
+import { ShareType } from '@nextcloud/sharing'
import DropdownIcon from 'vue-material-design-icons/TriangleSmallDown.vue'
import SharesMixin from '../mixins/SharesMixin.js'
import ShareDetails from '../mixins/ShareDetails.js'
-import ShareTypes from '../mixins/ShareTypes.js'
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
import IconEyeOutline from 'vue-material-design-icons/EyeOutline.vue'
@@ -52,7 +52,7 @@ export default {
NcActionButton,
},
- mixins: [SharesMixin, ShareDetails, ShareTypes],
+ mixins: [SharesMixin, ShareDetails],
props: {
share: {
@@ -122,7 +122,7 @@ export default {
supportsFileDrop() {
if (this.isFolder && this.config.isPublicUploadEnabled) {
const shareType = this.share.type ?? this.share.shareType
- return [this.SHARE_TYPES.SHARE_TYPE_LINK, this.SHARE_TYPES.SHARE_TYPE_EMAIL].includes(shareType)
+ return [ShareType.Link, ShareType.Email].includes(shareType)
}
return false
},
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 || '',
diff --git a/apps/files_sharing/src/mixins/ShareTypes.js b/apps/files_sharing/src/mixins/ShareTypes.js
deleted file mode 100644
index 4b0746a4849..00000000000
--- a/apps/files_sharing/src/mixins/ShareTypes.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-import { Type as ShareTypes } from '@nextcloud/sharing'
-
-export default {
- data() {
- return {
- SHARE_TYPES: ShareTypes,
- }
- },
-}
diff --git a/apps/files_sharing/src/mixins/SharesMixin.js b/apps/files_sharing/src/mixins/SharesMixin.js
index 4b51e4a97fb..55e31872da1 100644
--- a/apps/files_sharing/src/mixins/SharesMixin.js
+++ b/apps/files_sharing/src/mixins/SharesMixin.js
@@ -5,6 +5,7 @@
import { getCurrentUser } from '@nextcloud/auth'
import { showError, showSuccess } from '@nextcloud/dialogs'
+import { ShareType } from '@nextcloud/sharing'
import { emit } from '@nextcloud/event-bus'
import { fetchNode } from '../services/WebdavClient.ts'
@@ -13,7 +14,6 @@ import debounce from 'debounce'
import Share from '../models/Share.ts'
import SharesRequests from './ShareRequests.js'
-import ShareTypes from './ShareTypes.js'
import Config from '../services/ConfigService.ts'
import logger from '../services/logger.ts'
@@ -22,7 +22,7 @@ import {
} from '../lib/SharePermissionsToolBox.js'
export default {
- mixins: [SharesRequests, ShareTypes],
+ mixins: [SharesRequests],
props: {
fileInfo: {
@@ -44,6 +44,7 @@ export default {
return {
config: new Config(),
node: null,
+ ShareType,
// errors helpers
errors: {},
@@ -114,10 +115,10 @@ export default {
},
isPublicShare() {
const shareType = this.share.shareType ?? this.share.type
- return [this.SHARE_TYPES.SHARE_TYPE_LINK, this.SHARE_TYPES.SHARE_TYPE_EMAIL].includes(shareType)
+ return [ShareType.Link, ShareType.Email].includes(shareType)
},
isRemoteShare() {
- return this.share.type === this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP || this.share.type === this.SHARE_TYPES.SHARE_TYPE_REMOTE
+ return this.share.type === ShareType.RemoteGroup || this.share.type === ShareType.Remote
},
isShareOwner() {
return this.share && this.share.owner === getCurrentUser().uid
diff --git a/apps/files_sharing/src/services/ExternalShareActions.js b/apps/files_sharing/src/services/ExternalShareActions.js
index ae1f52e30b4..6ffd7014fe2 100644
--- a/apps/files_sharing/src/services/ExternalShareActions.js
+++ b/apps/files_sharing/src/services/ExternalShareActions.js
@@ -48,7 +48,7 @@ export default class ExternalShareActions {
if (typeof action !== 'object'
|| typeof action.id !== 'string'
|| typeof action.data !== 'function' // () => {disabled: true}
- || !Array.isArray(action.shareType) // [\@nextcloud/sharing.Types.SHARE_TYPE_LINK, ...]
+ || !Array.isArray(action.shareType) // [\@nextcloud/sharing.Types.Link, ...]
|| typeof action.handlers !== 'object' // {click: () => {}, ...}
|| !Object.values(action.handlers).every(handler => typeof handler === 'function')) {
console.error('Invalid action provided', action)
diff --git a/apps/files_sharing/src/share.js b/apps/files_sharing/src/share.js
index f02d357027f..cdc3c917dfa 100644
--- a/apps/files_sharing/src/share.js
+++ b/apps/files_sharing/src/share.js
@@ -7,7 +7,7 @@
/* eslint-disable */
import escapeHTML from 'escape-html'
-import { Type as ShareTypes } from '@nextcloud/sharing'
+import { ShareType } from '@nextcloud/sharing'
import { getCapabilities } from '@nextcloud/capabilities'
(function() {
@@ -155,25 +155,23 @@ import { getCapabilities } from '@nextcloud/capabilities'
var hasShares = false
_.each(shareTypesStr.split(',') || [], function(shareTypeStr) {
let shareType = parseInt(shareTypeStr, 10)
- if (shareType === ShareTypes.SHARE_TYPE_LINK) {
+ if (shareType === ShareType.Link) {
hasLink = true
- } else if (shareType === ShareTypes.SHARE_TYPE_EMAIL) {
+ } else if (shareType === ShareType.Email) {
hasLink = true
- } else if (shareType === ShareTypes.SHARE_TYPE_USER) {
+ } else if (shareType === ShareType.User) {
hasShares = true
- } else if (shareType === ShareTypes.SHARE_TYPE_GROUP) {
+ } else if (shareType === ShareType.Group) {
hasShares = true
- } else if (shareType === ShareTypes.SHARE_TYPE_REMOTE) {
+ } else if (shareType === ShareType.Remote) {
hasShares = true
- } else if (shareType === ShareTypes.SHARE_TYPE_REMOTE_GROUP) {
+ } else if (shareType === ShareType.RemoteGroup) {
hasShares = true
- } else if (shareType === ShareTypes.SHARE_TYPE_CIRCLE) {
+ } else if (shareType === ShareType.Team) {
hasShares = true
- } else if (shareType === ShareTypes.SHARE_TYPE_ROOM) {
+ } else if (shareType === ShareType.Room) {
hasShares = true
- } else if (shareType === ShareTypes.SHARE_TYPE_DECK) {
- hasShares = true
- } else if (shareType === ShareTypes.SHARE_TYPE_SCIENCEMESH) {
+ } else if (shareType === ShareType.Deck) {
hasShares = true
}
})
@@ -204,8 +202,8 @@ import { getCapabilities } from '@nextcloud/capabilities'
permissions: OC.PERMISSION_ALL,
iconClass: function(fileName, context) {
var shareType = parseInt(context.$file.data('share-types'), 10)
- if (shareType === ShareTypes.SHARE_TYPE_EMAIL
- || shareType === ShareTypes.SHARE_TYPE_LINK) {
+ if (shareType === ShareType.Email
+ || shareType === ShareType.Link) {
return 'icon-public'
}
return 'icon-shared'
diff --git a/apps/files_sharing/src/sharebreadcrumbview.js b/apps/files_sharing/src/sharebreadcrumbview.js
index 063881e2fe0..68ea75d4df9 100644
--- a/apps/files_sharing/src/sharebreadcrumbview.js
+++ b/apps/files_sharing/src/sharebreadcrumbview.js
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
-import { Type as ShareTypes } from '@nextcloud/sharing'
+import { ShareType } from '@nextcloud/sharing'
(function() {
'use strict'
@@ -23,7 +23,7 @@ import { Type as ShareTypes } from '@nextcloud/sharing'
this.$el.removeClass('shared icon-public icon-shared')
if (isShared) {
this.$el.addClass('shared')
- if (data.dirInfo.shareTypes.indexOf(ShareTypes.SHARE_TYPE_LINK) !== -1) {
+ if (data.dirInfo.shareTypes.indexOf(ShareType.Link) !== -1) {
this.$el.addClass('icon-public')
} else {
this.$el.addClass('icon-shared')
diff --git a/apps/files_sharing/src/utils/NodeShareUtils.ts b/apps/files_sharing/src/utils/NodeShareUtils.ts
index 7c51e3add69..f14f981e2ad 100644
--- a/apps/files_sharing/src/utils/NodeShareUtils.ts
+++ b/apps/files_sharing/src/utils/NodeShareUtils.ts
@@ -5,7 +5,7 @@
import { getCurrentUser } from '@nextcloud/auth'
import type { Node } from '@nextcloud/files'
-import { Type } from '@nextcloud/sharing'
+import { ShareType } from '@nextcloud/sharing'
type Share = {
/** The recipient display name */
@@ -13,7 +13,7 @@ type Share = {
/** The recipient user id */
id: string
/** The share type */
- type: Type
+ type: ShareType
}
const getSharesAttribute = function(node: Node) {
@@ -31,10 +31,10 @@ export const isNodeSharedWithMe = function(node: Node) {
return shares.length > 0 && (
// If some shares are shared with you as a direct user share
- shares.some(share => share.id === uid && share.type === Type.SHARE_TYPE_USER)
+ shares.some(share => share.id === uid && share.type === ShareType.User)
// Or of the file is shared with a group you're in
// (if it's returned by the backend, we assume you're in it)
- || shares.some(share => share.type === Type.SHARE_TYPE_GROUP)
+ || shares.some(share => share.type === ShareType.Group)
)
}
@@ -49,7 +49,7 @@ export const isNodeSharedWithOthers = function(node: Node) {
return shares.length > 0
// If some shares are shared with you as a direct user share
- && shares.some(share => share.id !== uid && share.type !== Type.SHARE_TYPE_GROUP)
+ && shares.some(share => share.id !== uid && share.type !== ShareType.Group)
}
export const isNodeShared = function(node: Node) {
diff --git a/apps/files_sharing/src/utils/SharedWithMe.js b/apps/files_sharing/src/utils/SharedWithMe.js
index 0b76e925ec9..2f63932bfbe 100644
--- a/apps/files_sharing/src/utils/SharedWithMe.js
+++ b/apps/files_sharing/src/utils/SharedWithMe.js
@@ -3,10 +3,10 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
-import { Type as ShareTypes } from '@nextcloud/sharing'
+import { ShareType } from '@nextcloud/sharing'
const shareWithTitle = function(share) {
- if (share.type === ShareTypes.SHARE_TYPE_GROUP) {
+ if (share.type === ShareType.Group) {
return t(
'files_sharing',
'Shared with you and the group {group} by {owner}',
@@ -17,7 +17,7 @@ const shareWithTitle = function(share) {
undefined,
{ escape: false },
)
- } else if (share.type === ShareTypes.SHARE_TYPE_CIRCLE) {
+ } else if (share.type === ShareType.Team) {
return t(
'files_sharing',
'Shared with you and {circle} by {owner}',
@@ -28,7 +28,7 @@ const shareWithTitle = function(share) {
undefined,
{ escape: false },
)
- } else if (share.type === ShareTypes.SHARE_TYPE_ROOM) {
+ } else if (share.type === ShareType.Room) {
if (share.shareWithDisplayName) {
return t(
'files_sharing',
diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue
index 70f49dea83e..c0c07cdf50d 100644
--- a/apps/files_sharing/src/views/SharingDetailsTab.vue
+++ b/apps/files_sharing/src/views/SharingDetailsTab.vue
@@ -8,7 +8,7 @@
<span>
<NcAvatar v-if="isUserShare"
class="sharing-entry__avatar"
- :is-no-user="share.shareType !== SHARE_TYPES.SHARE_TYPE_USER"
+ :is-no-user="share.shareType !== ShareType.User"
:user="share.shareWith"
:display-name="share.shareWithDisplayName"
:menu-position="'left'"
@@ -195,7 +195,7 @@
data-cy-files-sharing-share-permissions-checkbox="update">
{{ t('files_sharing', 'Edit') }}
</NcCheckboxRadioSwitch>
- <NcCheckboxRadioSwitch v-if="config.isResharingAllowed && share.type !== SHARE_TYPES.SHARE_TYPE_LINK"
+ <NcCheckboxRadioSwitch v-if="config.isResharingAllowed && share.type !== ShareType.Link"
:disabled="!canSetReshare"
:checked.sync="canReshare"
data-cy-files-sharing-share-permissions-checkbox="share">
@@ -277,7 +277,6 @@ import ExternalShareAction from '../components/ExternalShareAction.vue'
import GeneratePassword from '../utils/GeneratePassword.ts'
import Share from '../models/Share.ts'
import ShareRequests from '../mixins/ShareRequests.js'
-import ShareTypes from '../mixins/ShareTypes.js'
import SharesMixin from '../mixins/SharesMixin.js'
import logger from '../services/logger.ts'
@@ -312,7 +311,7 @@ export default {
MenuUpIcon,
DotsHorizontalIcon,
},
- mixins: [ShareTypes, ShareRequests, SharesMixin],
+ mixins: [ShareRequests, SharesMixin],
props: {
shareRequestValue: {
type: Object,
@@ -347,23 +346,23 @@ export default {
computed: {
title() {
switch (this.share.type) {
- case this.SHARE_TYPES.SHARE_TYPE_USER:
+ case ShareType.User:
return t('files_sharing', 'Share with {userName}', { userName: this.share.shareWithDisplayName })
- case this.SHARE_TYPES.SHARE_TYPE_EMAIL:
- return t('files_sharing', 'Share with email {email}', { email: this.share.shareWith })
- case this.SHARE_TYPES.SHARE_TYPE_LINK:
+ case ShareType.Email:
+ return t('files_sharing', 'Share with email {email}', { email: this.share.shareWith })
+ case ShareType.Link:
return t('files_sharing', 'Share link')
- case this.SHARE_TYPES.SHARE_TYPE_GROUP:
+ case ShareType.Group:
return t('files_sharing', 'Share with group')
- case this.SHARE_TYPES.SHARE_TYPE_ROOM:
+ case ShareType.Room:
return t('files_sharing', 'Share in conversation')
- case this.SHARE_TYPES.SHARE_TYPE_REMOTE: {
+ case ShareType.Remote: {
const [user, server] = this.share.shareWith.split('@')
return t('files_sharing', 'Share with {user} on remote server {server}', { user, server })
}
- case this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP:
+ case ShareType.RemoteGroup:
return t('files_sharing', 'Share with remote group')
- case this.SHARE_TYPES.SHARE_TYPE_GUEST:
+ case ShareType.Guest:
return t('files_sharing', 'Share with guest')
default: {
if (this.share.id) {
@@ -531,17 +530,17 @@ export default {
return new Date(new Date().setDate(new Date().getDate() + 1))
},
isUserShare() {
- return this.share.type === this.SHARE_TYPES.SHARE_TYPE_USER
+ return this.share.type === ShareType.User
},
isGroupShare() {
- return this.share.type === this.SHARE_TYPES.SHARE_TYPE_GROUP
+ return this.share.type === ShareType.Group
},
isNewShare() {
return !this.share.id
},
allowsFileDrop() {
if (this.isFolder && this.config.isPublicUploadEnabled) {
- if (this.share.type === this.SHARE_TYPES.SHARE_TYPE_LINK || this.share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL) {
+ if (this.share.type === ShareType.Link || this.share.type === ShareType.Email) {
return true
}
}
@@ -616,8 +615,8 @@ export default {
},
canRemoveReadPermission() {
return this.allowsFileDrop && (
- this.share.type === this.SHARE_TYPES.SHARE_TYPE_LINK
- || this.share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL
+ this.share.type === ShareType.Link
+ || this.share.type === ShareType.Email
)
},
// if newPassword exists, but is empty, it means
@@ -676,7 +675,7 @@ export default {
*/
isEmailShareType() {
return this.share
- ? this.share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL
+ ? this.share.type === ShareType.Email
: false
},
canTogglePasswordProtectedByTalkAvailable() {
@@ -1024,22 +1023,22 @@ export default {
},
getShareTypeIcon(type) {
switch (type) {
- case this.SHARE_TYPES.SHARE_TYPE_LINK:
+ case ShareType.Link:
return LinkIcon
- case this.SHARE_TYPES.SHARE_TYPE_GUEST:
+ case ShareType.Guest:
return UserIcon
- case this.SHARE_TYPES.SHARE_TYPE_REMOTE_GROUP:
- case this.SHARE_TYPES.SHARE_TYPE_GROUP:
+ case ShareType.RemoteGroup:
+ case ShareType.Group:
return GroupIcon
- case this.SHARE_TYPES.SHARE_TYPE_EMAIL:
+ case ShareType.Email:
return EmailIcon
- case this.SHARE_TYPES.SHARE_TYPE_CIRCLE:
+ case ShareType.Team:
return CircleIcon
- case this.SHARE_TYPES.SHARE_TYPE_ROOM:
+ case ShareType.Room:
return ShareIcon
- case this.SHARE_TYPES.SHARE_TYPE_DECK:
+ case ShareType.Deck:
return ShareIcon
- case this.SHARE_TYPES.SHARE_TYPE_SCIENCEMESH:
+ case ShareType.ScienceMesh:
return ShareIcon
default:
return null // Or a default icon component if needed
diff --git a/apps/files_sharing/src/views/SharingLinkList.vue b/apps/files_sharing/src/views/SharingLinkList.vue
index d9f13160241..3dd6fdf317b 100644
--- a/apps/files_sharing/src/views/SharingLinkList.vue
+++ b/apps/files_sharing/src/views/SharingLinkList.vue
@@ -32,12 +32,13 @@
<script>
import { getCapabilities } from '@nextcloud/capabilities'
+
import { t } from '@nextcloud/l10n'
import Share from '../models/Share.js'
-import ShareTypes from '../mixins/ShareTypes.js'
import SharingEntryLink from '../components/SharingEntryLink.vue'
import ShareDetails from '../mixins/ShareDetails.js'
+import { ShareType } from '@nextcloud/sharing'
export default {
name: 'SharingLinkList',
@@ -46,7 +47,7 @@ export default {
SharingEntryLink,
},
- mixins: [ShareTypes, ShareDetails],
+ mixins: [ShareDetails],
props: {
fileInfo: {
@@ -80,7 +81,7 @@ export default {
* @return {Array}
*/
hasLinkShares() {
- return this.shares.filter(share => share.type === this.SHARE_TYPES.SHARE_TYPE_LINK).length > 0
+ return this.shares.filter(share => share.type === ShareType.Link).length > 0
},
/**
diff --git a/apps/files_sharing/src/views/SharingList.vue b/apps/files_sharing/src/views/SharingList.vue
index 4d25e5cfeec..2167059772e 100644
--- a/apps/files_sharing/src/views/SharingList.vue
+++ b/apps/files_sharing/src/views/SharingList.vue
@@ -17,8 +17,8 @@
<script>
import { t } from '@nextcloud/l10n'
import SharingEntry from '../components/SharingEntry.vue'
-import ShareTypes from '../mixins/ShareTypes.js'
import ShareDetails from '../mixins/ShareDetails.js'
+import { ShareType } from '@nextcloud/sharing'
export default {
name: 'SharingList',
@@ -27,7 +27,7 @@ export default {
SharingEntry,
},
- mixins: [ShareTypes, ShareDetails],
+ mixins: [ShareDetails],
props: {
fileInfo: {
@@ -54,7 +54,7 @@ export default {
isUnique() {
return (share) => {
return [...this.shares].filter((item) => {
- return share.type === this.SHARE_TYPES.SHARE_TYPE_USER && share.shareWithDisplayName === item.shareWithDisplayName
+ return share.type === ShareType.User && share.shareWithDisplayName === item.shareWithDisplayName
}).length <= 1
}
},
diff --git a/apps/files_sharing/src/views/SharingTab.vue b/apps/files_sharing/src/views/SharingTab.vue
index 6870e43d816..69735018ccd 100644
--- a/apps/files_sharing/src/views/SharingTab.vue
+++ b/apps/files_sharing/src/views/SharingTab.vue
@@ -87,6 +87,7 @@ import { orderBy } from '@nextcloud/files'
import { loadState } from '@nextcloud/initial-state'
import { generateOcsUrl } from '@nextcloud/router'
import { CollectionList } from 'nextcloud-vue-collections'
+import { ShareType } from '@nextcloud/sharing'
import axios from '@nextcloud/axios'
import moment from '@nextcloud/moment'
@@ -96,7 +97,6 @@ import { shareWithTitle } from '../utils/SharedWithMe.js'
import Config from '../services/ConfigService.ts'
import Share from '../models/Share.ts'
-import ShareTypes from '../mixins/ShareTypes.js'
import SharingEntryInternal from '../components/SharingEntryInternal.vue'
import SharingEntrySimple from '../components/SharingEntrySimple.vue'
import SharingInput from '../components/SharingInput.vue'
@@ -121,8 +121,6 @@ export default {
SharingDetailsTab,
},
- mixins: [ShareTypes],
-
data() {
return {
config: new Config(),
@@ -277,8 +275,8 @@ export default {
],
)
- this.linkShares = shares.filter(share => share.type === this.SHARE_TYPES.SHARE_TYPE_LINK || share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL)
- this.shares = shares.filter(share => share.type !== this.SHARE_TYPES.SHARE_TYPE_LINK && share.type !== this.SHARE_TYPES.SHARE_TYPE_EMAIL)
+ this.linkShares = shares.filter(share => share.type === ShareType.Link || share.type === ShareType.Email)
+ this.shares = shares.filter(share => share.type !== ShareType.Link && share.type !== ShareType.Email)
console.debug('Processed', this.linkShares.length, 'link share(s)')
console.debug('Processed', this.shares.length, 'share(s)')
@@ -340,7 +338,7 @@ export default {
addShare(share, resolve = () => { }) {
// only catching share type MAIL as link shares are added differently
// meaning: not from the ShareInput
- if (share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL) {
+ if (share.type === ShareType.Email) {
this.linkShares.unshift(share)
} else {
this.shares.unshift(share)
@@ -355,8 +353,8 @@ export default {
removeShare(share) {
// Get reference for this.linkShares or this.shares
const shareList
- = share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL
- || share.type === this.SHARE_TYPES.SHARE_TYPE_LINK
+ = share.type === ShareType.Email
+ || share.type === ShareType.Link
? this.linkShares
: this.shares
const index = shareList.findIndex(item => item.id === share.id)
@@ -377,7 +375,7 @@ export default {
let listComponent = this.$refs.shareList
// Only mail shares comes from the input, link shares
// are managed internally in the SharingLinkList component
- if (share.type === this.SHARE_TYPES.SHARE_TYPE_EMAIL) {
+ if (share.type === ShareType.Email) {
listComponent = this.$refs.linkShareList
}
const newShare = listComponent.$children.find(component => component.share === share)
diff --git a/package-lock.json b/package-lock.json
index 4d29d6d41c7..3c80c781711 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -28,7 +28,7 @@
"@nextcloud/password-confirmation": "^5.3.0",
"@nextcloud/paths": "^2.2.1",
"@nextcloud/router": "^3.0.1",
- "@nextcloud/sharing": "^0.2.3",
+ "@nextcloud/sharing": "^0.2.4",
"@nextcloud/upload": "^1.7.0",
"@nextcloud/vue": "^8.20.0",
"@simplewebauthn/browser": "^12.0.0",
@@ -4107,10 +4107,9 @@
}
},
"node_modules/@nextcloud/sharing": {
- "version": "0.2.3",
- "resolved": "https://registry.npmjs.org/@nextcloud/sharing/-/sharing-0.2.3.tgz",
- "integrity": "sha512-hxQFOBBahbJkcmAGZFVS3943pQGSafNF6LMHmgcj0JPqExu1DWKuZvsCXZnGkaRJVcewHnZFcLAhpOf+VfcZmA==",
- "license": "GPL-3.0-or-later",
+ "version": "0.2.4",
+ "resolved": "https://registry.npmjs.org/@nextcloud/sharing/-/sharing-0.2.4.tgz",
+ "integrity": "sha512-kOLAr0w4NDUGPF42L22i9iSs6Z3ylTsE0RudAGDBzw/pnxGY8PEwZI2j0IMAFRfQ7XFNcpV/EVHI5YCMxtxGMQ==",
"dependencies": {
"@nextcloud/initial-state": "^2.2.0"
},
diff --git a/package.json b/package.json
index 5de3a96a5e8..a585edb5a7b 100644
--- a/package.json
+++ b/package.json
@@ -59,7 +59,7 @@
"@nextcloud/password-confirmation": "^5.3.0",
"@nextcloud/paths": "^2.2.1",
"@nextcloud/router": "^3.0.1",
- "@nextcloud/sharing": "^0.2.3",
+ "@nextcloud/sharing": "^0.2.4",
"@nextcloud/upload": "^1.7.0",
"@nextcloud/vue": "^8.20.0",
"@simplewebauthn/browser": "^12.0.0",
@@ -204,4 +204,4 @@
"overrides": {
"colors": "1.4.0"
}
-} \ No newline at end of file
+}