Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(files): hide move dialog action if destination has no CREATE permission #50177

Merged
merged 2 commits into from
Jan 15, 2025
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
5 changes: 5 additions & 0 deletions apps/files/src/actions/moveOrCopyAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
* @param action The action to open the file picker for
* @param dir The directory to start the file picker in
* @param nodes The nodes to move/copy
* @return The picked destination or false if cancelled by user

Check warning on line 210 in apps/files/src/actions/moveOrCopyAction.ts

View workflow job for this annotation

GitHub Actions / NPM lint

Missing JSDoc @return type
*/
async function openFilePickerForAction(
action: MoveCopyAction,
Expand Down Expand Up @@ -258,6 +258,11 @@
return buttons
}

if (selection.some((node) => (node.permissions & Permission.CREATE) === 0)) {
// Missing 'CREATE' permissions for selected destination
return buttons
}

if (action === MoveCopyAction.MOVE || action === MoveCopyAction.MOVE_OR_COPY) {
buttons.push({
label: target ? t('files', 'Move to {target}', { target }, undefined, { escape: false, sanitize: false }) : t('files', 'Move'),
Expand Down
Loading