diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-11-15 02:03:06 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-11-18 12:25:56 +0100 |
commit | bb26289ef3900d42db4d4052401d82883671e3f0 (patch) | |
tree | b747cff1b0ede7b01549675ea4bd29634ed0d404 /apps/files/src | |
parent | ad40841ae8a1ba1296729b2451f3ad12647ae8a0 (diff) | |
download | nextcloud-server-bb26289ef3900d42db4d4052401d82883671e3f0.tar.gz nextcloud-server-bb26289ef3900d42db4d4052401d82883671e3f0.zip |
refactor(files): Replace deprecated `Types` enum for share types
Replace with `ShareType` enum.
Also fix some small Typescript issues in `FilesList.vue`.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/files/src')
-rw-r--r-- | apps/files/src/views/FilesList.vue | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/apps/files/src/views/FilesList.vue b/apps/files/src/views/FilesList.vue index 23aab26f839..56907db3feb 100644 --- a/apps/files/src/views/FilesList.vue +++ b/apps/files/src/views/FilesList.vue @@ -17,7 +17,7 @@ type="tertiary" @click="openSharingSidebar"> <template #icon> - <LinkIcon v-if="shareButtonType === Type.SHARE_TYPE_LINK" /> + <LinkIcon v-if="shareButtonType === ShareType.Link" /> <AccountPlusIcon v-else :size="20" /> </template> </NcButton> @@ -141,7 +141,7 @@ </template> <script lang="ts"> -import type { ContentsWithRoot, INode } from '@nextcloud/files' +import type { ContentsWithRoot, Folder, INode } from '@nextcloud/files' import type { Upload } from '@nextcloud/upload' import type { CancelablePromise } from 'cancelable-promise' import type { ComponentPublicInstance } from 'vue' @@ -150,11 +150,11 @@ import type { UserConfig } from '../types.ts' import { getCapabilities } from '@nextcloud/capabilities' import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus' -import { Folder, Node, Permission, sortNodes, getFileListActions } from '@nextcloud/files' +import { Node, Permission, sortNodes, getFileListActions } from '@nextcloud/files' import { translate as t } from '@nextcloud/l10n' import { join, dirname, normalize } from 'path' import { showError, showWarning } from '@nextcloud/dialogs' -import { Type } from '@nextcloud/sharing' +import { ShareType } from '@nextcloud/sharing' import { UploadPicker, UploadStatus } from '@nextcloud/upload' import { loadState } from '@nextcloud/initial-state' import { defineComponent } from 'vue' @@ -261,7 +261,7 @@ export default defineComponent({ // non reactive data enableGridView, forbiddenCharacters, - Type, + ShareType, } }, @@ -391,22 +391,22 @@ export default defineComponent({ return t('files', 'Share') } - if (this.shareButtonType === Type.SHARE_TYPE_LINK) { + if (this.shareButtonType === ShareType.Link) { return t('files', 'Shared by link') } return t('files', 'Shared') }, - shareButtonType(): Type | null { + shareButtonType(): ShareType | null { if (!this.shareTypesAttributes) { return null } // If all types are links, show the link icon - if (this.shareTypesAttributes.some(type => type === Type.SHARE_TYPE_LINK)) { - return Type.SHARE_TYPE_LINK + if (this.shareTypesAttributes.some(type => type === ShareType.Link)) { + return ShareType.Link } - return Type.SHARE_TYPE_USER + return ShareType.User }, gridViewButtonLabel() { @@ -454,7 +454,11 @@ export default defineComponent({ if (action.enabled === undefined) { return true } - return action.enabled(this.currentView, this.dirContents, { folder: this.currentFolder }) + return action.enabled( + this.currentView!, + this.dirContents, + { folder: this.currentFolder! }, + ) }) .toSorted((a, b) => a.order - b.order) return enabledActions |