Skip to content

Commit

Permalink
Merge pull request #48352 from nextcloud/backport/48331/stable28
Browse files Browse the repository at this point in the history
[stable28] fix(files): Fix having to resolve conflicts twice when dropping files
  • Loading branch information
Pytal authored Sep 25, 2024
2 parents 3225dc5 + 27e4080 commit f463688
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 19 deletions.
24 changes: 13 additions & 11 deletions apps/files/src/actions/moveOrCopyAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,19 +142,21 @@ export const handleCopyMoveNodeTo = async (node: Node, destination: Folder, meth
}
} else {
// show conflict file popup if we do not allow overwriting
const otherNodes = await getContents(destination.path)
if (hasConflict([node], otherNodes.contents)) {
try {
// Let the user choose what to do with the conflicting files
const { selected, renamed } = await openConflictPicker(destination.path, [node], otherNodes.contents)
// two empty arrays: either only old files or conflict skipped -> no action required
if (!selected.length && !renamed.length) {
if (!overwrite) {
const otherNodes = await getContents(destination.path)
if (hasConflict([node], otherNodes.contents)) {
try {
// Let the user choose what to do with the conflicting files
const { selected, renamed } = await openConflictPicker(destination.path, [node], otherNodes.contents)
// two empty arrays: either only old files or conflict skipped -> no action required
if (!selected.length && !renamed.length) {
return
}
} catch (error) {
// User cancelled
showError(t('files', 'Move cancelled'))
return
}
} catch (error) {
// User cancelled
showError(t('files', 'Move cancelled'))
return
}
}
// getting here means either no conflict, file was renamed to keep both files
Expand Down
3 changes: 1 addition & 2 deletions apps/files/src/services/DropService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ export const onDropInternalFiles = async (nodes: Node[], destination: Folder, co

for (const node of nodes) {
Vue.set(node, 'status', NodeStatus.LOADING)
// TODO: resolve potential conflicts prior and force overwrite
queue.push(handleCopyMoveNodeTo(node, destination, isCopy ? MoveCopyAction.COPY : MoveCopyAction.MOVE))
queue.push(handleCopyMoveNodeTo(node, destination, isCopy ? MoveCopyAction.COPY : MoveCopyAction.MOVE, true))
}

// Wait for all promises to settle
Expand Down
4 changes: 2 additions & 2 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.

4 changes: 2 additions & 2 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 f463688

Please sign in to comment.