From 9404059f6c4338b9214ac2b3504a2282d7d1754b 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 --- .../src/files_actions/sharingStatusAction.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/src/files_actions/sharingStatusAction.ts b/apps/files_sharing/src/files_actions/sharingStatusAction.ts index ed562db5953..b5cdcdfc016 100644 --- a/apps/files_sharing/src/files_actions/sharingStatusAction.ts +++ b/apps/files_sharing/src/files_actions/sharingStatusAction.ts @@ -17,6 +17,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 @@ -125,15 +126,23 @@ 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) { // You need read permissions to see the sidebar if ((node.permissions & Permission.READ) !== 0) { window.OCA?.Files?.Sidebar?.setActiveTab?.('sharing') - return await sidebarAction.exec(node, view, dir) + sidebarAction.exec(node, view, dir) + return null } + + // 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 },