Skip to content

Commit 0f5b5b3

Browse files
Merge pull request #54556 from nextcloud/backport/54410/stable30
[stable30] fix(files_sharing): sharing status action permission and sidebar await
2 parents a467ea8 + 4d2aff7 commit 0f5b5b3

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

apps/files_sharing/src/actions/sharingStatusAction.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { action as sidebarAction } from '../../../files/src/actions/sidebarActio
1616
import { generateAvatarSvg } from '../utils/AccountIcon'
1717

1818
import './sharingStatusAction.scss'
19+
import { showError } from '@nextcloud/dialogs'
1920

2021
const isExternal = (node: Node) => {
2122
return node.attributes?.['is-federated'] ?? false
@@ -118,15 +119,23 @@ export const action = new FileAction({
118119
return true
119120
}
120121

122+
// You need share permissions to share this file
123+
// and read permissions to see the sidebar
121124
return (node.permissions & Permission.SHARE) !== 0
125+
&& (node.permissions & Permission.READ) !== 0
122126
},
123127

124128
async exec(node: Node, view: View, dir: string) {
125129
// You need read permissions to see the sidebar
126130
if ((node.permissions & Permission.READ) !== 0) {
127131
window.OCA?.Files?.Sidebar?.setActiveTab?.('sharing')
128-
return sidebarAction.exec(node, view, dir)
132+
sidebarAction.exec(node, view, dir)
133+
return null
129134
}
135+
136+
// Should not happen as the enabled check should prevent this
137+
// leaving it here for safety or in case someone calls this action directly
138+
showError(t('files_sharing', 'You do not have enough permissions to share this file.'))
130139
return null
131140
},
132141

0 commit comments

Comments
 (0)