From b9087d70a0945c91d0f6bbb08fd03914ae4d151d Mon Sep 17 00:00:00 2001 From: skjnldsv Date: Thu, 14 Aug 2025 22:06:09 +0200 Subject: [PATCH] fix(files_sharing): sharing status action permission and sidebar await Signed-off-by: skjnldsv [skip ci] --- apps/files_sharing/src/actions/sharingStatusAction.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/files_sharing/src/actions/sharingStatusAction.ts b/apps/files_sharing/src/actions/sharingStatusAction.ts index fc155985eee..a4129faff76 100644 --- a/apps/files_sharing/src/actions/sharingStatusAction.ts +++ b/apps/files_sharing/src/actions/sharingStatusAction.ts @@ -16,6 +16,7 @@ import { action as sidebarAction } from '../../../files/src/actions/sidebarActio import { generateAvatarSvg } from '../utils/AccountIcon' import './sharingStatusAction.scss' +import { showError } from '@nextcloud/dialogs' const isExternal = (node: Node) => { return node.attributes?.['is-federated'] ?? false @@ -118,7 +119,10 @@ export const action = new FileAction({ return true } + // You need share permissions to share this file + // and read permissions to see the sidebar return (node.permissions & Permission.SHARE) !== 0 + && (node.permissions & Permission.READ) !== 0 }, async exec(node: Node, view: View, dir: string) { @@ -127,6 +131,10 @@ export const action = new FileAction({ window.OCA?.Files?.Sidebar?.setActiveTab?.('sharing') return sidebarAction.exec(node, view, dir) } + + // Should not happen as the enabled check should prevent this + // leaving it here for safety or in case someone calls this action directly + showError(t('files_sharing', 'You do not have enough permissions to share this file.')) return null },