diff options
Diffstat (limited to 'apps/files/src')
-rw-r--r-- | apps/files/src/actions/renameAction.ts | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/apps/files/src/actions/renameAction.ts b/apps/files/src/actions/renameAction.ts index e4dbb0ed129..13ba32aaae9 100644 --- a/apps/files/src/actions/renameAction.ts +++ b/apps/files/src/actions/renameAction.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ import { emit } from '@nextcloud/event-bus' -import { Permission, type Node, FileAction } from '@nextcloud/files' +import { Permission, type Node, FileAction, View } from '@nextcloud/files' import { translate as t } from '@nextcloud/l10n' import PencilSvg from '@mdi/svg/svg/pencil.svg?raw' @@ -14,10 +14,16 @@ export const action = new FileAction({ displayName: () => t('files', 'Rename'), iconSvgInline: () => PencilSvg, - enabled: (nodes: Node[]) => { - return nodes.length > 0 && nodes - .map(node => node.permissions) - .every(permission => Boolean(permission & Permission.DELETE)) + enabled: (nodes: Node[], view: View) => { + if (nodes.length === 0) { + return false + } + // Disable for single file shares + if (view.id === 'public-file-share') { + return false + } + // Only enable if all nodes have the delete permission + return nodes.every((node) => Boolean(node.permissions & Permission.DELETE)) }, async exec(node: Node) { |