fix(FilesPicker): Prevent selection of nodes without create permission

And remove the disable callback for the button as it is not needed anymore.

This gives a better experience as the nodes do not have a pointer for cursor, and the submit button does not react when clicking on them.

Signed-off-by: Louis Chmn <louis@chmn.me>
This commit is contained in:
Louis Chmn 2025-10-17 11:05:44 +02:00 committed by backportbot[bot]
parent 55228fe20c
commit fa01bbc98a

View file

@ -221,6 +221,10 @@ async function openFilePickerForAction(
// We don't want to show the current nodes in the file picker
return !fileIDs.includes(n.fileid)
})
.setCanPick((n) => {
const hasCreatePermissions = (n.permissions & Permission.CREATE) === Permission.CREATE
return hasCreatePermissions
})
.setMimeTypeFilter([])
.setMultiSelect(false)
.startAt(dir)
@ -236,7 +240,6 @@ async function openFilePickerForAction(
label: target ? t('files', 'Copy to {target}', { target }, undefined, { escape: false, sanitize: false }) : t('files', 'Copy'),
type: 'primary',
icon: CopyIconSvg,
disabled: selection.some((node) => (node.permissions & Permission.CREATE) === 0),
async callback(destination: Node[]) {
resolve({
destination: destination[0] as Folder,