mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
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:
parent
55228fe20c
commit
fa01bbc98a
1 changed files with 4 additions and 1 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue