Skip to content

Commit

Permalink
fix(files): Show non writable folders during move or copy
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
artonge committed Jun 10, 2024
1 parent ad73418 commit 8452ba7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
9 changes: 4 additions & 5 deletions apps/files/src/actions/moveOrCopyAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,15 @@ const openFilePickerForAction = async (action: MoveCopyAction, dir = '/', nodes:
const filePicker = getFilePickerBuilder(t('files', 'Choose destination'))
.allowDirectories(true)
.setFilter((n: Node) => {
// We only want to show folders that we can create nodes in
return (n.permissions & Permission.CREATE) !== 0
// We don't want to show the current nodes in the file picker
&& !fileIDs.includes(n.fileid)
// We don't want to show the current nodes in the file picker
return !fileIDs.includes(n.fileid)
})
.setMimeTypeFilter([])
.setMultiSelect(false)
.startAt(dir)

return new Promise((resolve, reject) => {
filePicker.setButtonFactory((_selection, path: string) => {
filePicker.setButtonFactory((selection: Node[], path: string) => {
const buttons: IFilePickerButton[] = []
const target = basename(path)

Expand All @@ -204,6 +202,7 @@ const openFilePickerForAction = async (action: MoveCopyAction, dir = '/', nodes:
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,
Expand Down
6 changes: 3 additions & 3 deletions dist/files-init.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-init.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/files-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-main.js.map

Large diffs are not rendered by default.

0 comments on commit 8452ba7

Please sign in to comment.