From 8b36b915febf76ade3e00c2d0563a370e8ba9f62 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Fri, 28 Feb 2025 18:13:24 +0100 Subject: fix(files_trashbin): disable bulk download for trashbin The backend does not allow bulk download within the trashbin, so we need to disable this also on the frontend. Signed-off-by: Ferdinand Thiessen --- apps/files/src/actions/downloadAction.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'apps/files/src') diff --git a/apps/files/src/actions/downloadAction.ts b/apps/files/src/actions/downloadAction.ts index 19e0b3502fa..b4c04d2970c 100644 --- a/apps/files/src/actions/downloadAction.ts +++ b/apps/files/src/actions/downloadAction.ts @@ -2,7 +2,8 @@ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -import { FileAction, Node, FileType, DefaultType } from '@nextcloud/files' +import type { Node, View } from '@nextcloud/files' +import { FileAction, FileType, DefaultType } from '@nextcloud/files' import { t } from '@nextcloud/l10n' import { isDownloadable } from '../utils/permissions' @@ -75,7 +76,7 @@ export const action = new FileAction({ displayName: () => t('files', 'Download'), iconSvgInline: () => ArrowDownSvg, - enabled(nodes: Node[]) { + enabled(nodes: Node[], view: View) { if (nodes.length === 0) { return false } @@ -85,6 +86,11 @@ export const action = new FileAction({ return false } + // Trashbin does not allow batch download + if (nodes.length > 1 && view.id === 'trashbin') { + return false + } + return nodes.every(isDownloadable) }, -- cgit v1.2.3