Skip to content

Commit 908160e

Browse files
authored
Merge pull request #54555 from nextcloud/backport/54410/stable31
2 parents ae0cf2a + b0c1c23 commit 908160e

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

apps/files_sharing/src/files_actions/sharingStatusAction.ts

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

1919
import './sharingStatusAction.scss'
20+
import { showError } from '@nextcloud/dialogs'
2021

2122
const isExternal = (node: Node) => {
2223
return node.attributes?.['is-federated'] ?? false
@@ -125,15 +126,23 @@ export const action = new FileAction({
125126
return true
126127
}
127128

129+
// You need share permissions to share this file
130+
// and read permissions to see the sidebar
128131
return (node.permissions & Permission.SHARE) !== 0
132+
&& (node.permissions & Permission.READ) !== 0
129133
},
130134

131135
async exec(node: Node, view: View, dir: string) {
132136
// You need read permissions to see the sidebar
133137
if ((node.permissions & Permission.READ) !== 0) {
134138
window.OCA?.Files?.Sidebar?.setActiveTab?.('sharing')
135-
return sidebarAction.exec(node, view, dir)
139+
sidebarAction.exec(node, view, dir)
140+
return null
136141
}
142+
143+
// Should not happen as the enabled check should prevent this
144+
// leaving it here for safety or in case someone calls this action directly
145+
showError(t('files_sharing', 'You do not have enough permissions to share this file.'))
137146
return null
138147
},
139148

dist/files_sharing-init.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files_sharing-init.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)