Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(files_sharing): sharing status action permission and sidebar await
Signed-off-by: skjnldsv <[email protected]>
  • Loading branch information
skjnldsv committed Aug 20, 2025
commit 9404059f6c4338b9214ac2b3504a2282d7d1754b
11 changes: 10 additions & 1 deletion apps/files_sharing/src/files_actions/sharingStatusAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO its better to await it here so that we can trust all work is done and not pending branches exist

Suggested change
sidebarAction.exec(node, view, dir)
await sidebarAction.exec(node, view, dir)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I thought about it, I kinda thought I would be confortable awaiting for the sidebar when we'll have it properly re-written with the right api and Node usage 🙈

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
},

Expand Down