aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorskjnldsv <skjnldsv@protonmail.com>2024-07-26 09:54:25 +0200
committernextcloud-command <nextcloud-command@users.noreply.github.com>2024-07-30 09:50:46 +0000
commit197c35598cc6b1b8142a45afa89d213f8338d3f3 (patch)
treeb297e90eb0209c06e8a6f900144e4be95f00bb18 /apps/files
parent850cb082a91d6e18e64fdbaafaa3be9ede59123f (diff)
downloadnextcloud-server-197c35598cc6b1b8142a45afa89d213f8338d3f3.tar.gz
nextcloud-server-197c35598cc6b1b8142a45afa89d213f8338d3f3.zip
chore(files_sharing): refactor Share model to ts
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/src/actions/downloadAction.ts7
-rw-r--r--apps/files/src/actions/moveOrCopyActionUtils.ts8
2 files changed, 7 insertions, 8 deletions
diff --git a/apps/files/src/actions/downloadAction.ts b/apps/files/src/actions/downloadAction.ts
index a63beaca3f2..3ba4e23f0cf 100644
--- a/apps/files/src/actions/downloadAction.ts
+++ b/apps/files/src/actions/downloadAction.ts
@@ -2,9 +2,12 @@
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
-import { generateUrl } from '@nextcloud/router'
+import type { ShareAttribute } from '../../../files_sharing/src/sharing'
+
import { FileAction, Permission, Node, FileType, View } from '@nextcloud/files'
+import { generateUrl } from '@nextcloud/router'
import { translate as t } from '@nextcloud/l10n'
+
import ArrowDownSvg from '@mdi/svg/svg/arrow-down.svg?raw'
const triggerDownload = function(url: string) {
@@ -31,7 +34,7 @@ const isDownloadable = function(node: Node) {
// If the mount type is a share, ensure it got download permissions.
if (node.attributes['mount-type'] === 'shared') {
- const shareAttributes = JSON.parse(node.attributes['share-attributes'] ?? 'null')
+ const shareAttributes = JSON.parse(node.attributes['share-attributes'] ?? '[]') as Array<ShareAttribute>
const downloadAttribute = shareAttributes?.find?.((attribute: { scope: string; key: string }) => attribute.scope === 'permissions' && attribute.key === 'download')
if (downloadAttribute !== undefined && downloadAttribute.value === false) {
return false
diff --git a/apps/files/src/actions/moveOrCopyActionUtils.ts b/apps/files/src/actions/moveOrCopyActionUtils.ts
index 091df56e655..d2e276b2b93 100644
--- a/apps/files/src/actions/moveOrCopyActionUtils.ts
+++ b/apps/files/src/actions/moveOrCopyActionUtils.ts
@@ -4,6 +4,8 @@
*/
import type { Folder, Node } from '@nextcloud/files'
+import type { ShareAttribute } from '../../../files_sharing/src/sharing'
+
import { Permission } from '@nextcloud/files'
import PQueue from 'p-queue'
@@ -23,12 +25,6 @@ export const getQueue = () => {
return queue
}
-type ShareAttribute = {
- value: boolean|string|number|null|object|Array<unknown>
- key: string
- scope: string
-}
-
export enum MoveCopyAction {
MOVE = 'Move',
COPY = 'Copy',