Skip to content

Commit c74ba56

Browse files
authored
Merge pull request #49300 from nextcloud/refactor/files-deprecated-share-types
refactor(files): Replace deprecated `Types` enum for share types
2 parents ad40841 + 7e55c87 commit c74ba56

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

apps/files/src/views/FilesList.vue

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
type="tertiary"
1818
@click="openSharingSidebar">
1919
<template #icon>
20-
<LinkIcon v-if="shareButtonType === Type.SHARE_TYPE_LINK" />
20+
<LinkIcon v-if="shareButtonType === ShareType.Link" />
2121
<AccountPlusIcon v-else :size="20" />
2222
</template>
2323
</NcButton>
@@ -141,7 +141,7 @@
141141
</template>
142142

143143
<script lang="ts">
144-
import type { ContentsWithRoot, INode } from '@nextcloud/files'
144+
import type { ContentsWithRoot, Folder, INode } from '@nextcloud/files'
145145
import type { Upload } from '@nextcloud/upload'
146146
import type { CancelablePromise } from 'cancelable-promise'
147147
import type { ComponentPublicInstance } from 'vue'
@@ -150,11 +150,11 @@ import type { UserConfig } from '../types.ts'
150150
151151
import { getCapabilities } from '@nextcloud/capabilities'
152152
import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
153-
import { Folder, Node, Permission, sortNodes, getFileListActions } from '@nextcloud/files'
153+
import { Node, Permission, sortNodes, getFileListActions } from '@nextcloud/files'
154154
import { translate as t } from '@nextcloud/l10n'
155155
import { join, dirname, normalize } from 'path'
156156
import { showError, showWarning } from '@nextcloud/dialogs'
157-
import { Type } from '@nextcloud/sharing'
157+
import { ShareType } from '@nextcloud/sharing'
158158
import { UploadPicker, UploadStatus } from '@nextcloud/upload'
159159
import { loadState } from '@nextcloud/initial-state'
160160
import { defineComponent } from 'vue'
@@ -261,7 +261,7 @@ export default defineComponent({
261261
// non reactive data
262262
enableGridView,
263263
forbiddenCharacters,
264-
Type,
264+
ShareType,
265265
}
266266
},
267267
@@ -391,22 +391,22 @@ export default defineComponent({
391391
return t('files', 'Share')
392392
}
393393
394-
if (this.shareButtonType === Type.SHARE_TYPE_LINK) {
394+
if (this.shareButtonType === ShareType.Link) {
395395
return t('files', 'Shared by link')
396396
}
397397
return t('files', 'Shared')
398398
},
399-
shareButtonType(): Type | null {
399+
shareButtonType(): ShareType | null {
400400
if (!this.shareTypesAttributes) {
401401
return null
402402
}
403403
404404
// If all types are links, show the link icon
405-
if (this.shareTypesAttributes.some(type => type === Type.SHARE_TYPE_LINK)) {
406-
return Type.SHARE_TYPE_LINK
405+
if (this.shareTypesAttributes.some(type => type === ShareType.Link)) {
406+
return ShareType.Link
407407
}
408408
409-
return Type.SHARE_TYPE_USER
409+
return ShareType.User
410410
},
411411
412412
gridViewButtonLabel() {
@@ -454,7 +454,11 @@ export default defineComponent({
454454
if (action.enabled === undefined) {
455455
return true
456456
}
457-
return action.enabled(this.currentView, this.dirContents, { folder: this.currentFolder })
457+
return action.enabled(
458+
this.currentView!,
459+
this.dirContents,
460+
{ folder: this.currentFolder! },
461+
)
458462
})
459463
.toSorted((a, b) => a.order - b.order)
460464
return enabledActions

dist/files-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)