mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix(files_sharing): sharing status action permission and sidebar await
Signed-off-by: skjnldsv <skjnldsv@protonmail.com> [skip ci]
This commit is contained in:
parent
ae0cf2a553
commit
eb53d1a700
1 changed files with 8 additions and 0 deletions
|
|
@ -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,7 +126,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) {
|
||||
|
|
@ -134,6 +138,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
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue