@@ -16,6 +16,7 @@ import { action as sidebarAction } from '../../../files/src/actions/sidebarActio
1616import { generateAvatarSvg } from '../utils/AccountIcon'
1717
1818import './sharingStatusAction.scss'
19+ import { showError } from '@nextcloud/dialogs'
1920
2021const 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