mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 08:16:43 -04:00
Merge pull request #43811 from nextcloud/backport/43667/stable28
[stable28] fix: merge conflict dialog added when overwriting files on move-file action
This commit is contained in:
commit
da2a6c0ec4
13 changed files with 41 additions and 18 deletions
|
|
@ -32,12 +32,14 @@ import { emit } from '@nextcloud/event-bus'
|
|||
import { FilePickerClosed, getFilePickerBuilder, showError } from '@nextcloud/dialogs'
|
||||
import { Permission, FileAction, FileType, NodeStatus, davGetClient, davRootPath, davResultToNode, davGetDefaultPropfind } from '@nextcloud/files'
|
||||
import { translate as t } from '@nextcloud/l10n'
|
||||
import { openConflictPicker, hasConflict } from '@nextcloud/upload'
|
||||
import Vue from 'vue'
|
||||
|
||||
import CopyIconSvg from '@mdi/svg/svg/folder-multiple.svg?raw'
|
||||
import FolderMoveSvg from '@mdi/svg/svg/folder-move.svg?raw'
|
||||
|
||||
import { MoveCopyAction, canCopy, canMove, getQueue } from './moveOrCopyActionUtils'
|
||||
import { getContents } from '../services/Files'
|
||||
import logger from '../logger'
|
||||
import { getUniqueName } from '../utils/fileUtils'
|
||||
|
||||
|
|
@ -133,6 +135,27 @@ export const handleCopyMoveNodeTo = async (node: Node, destination: Folder, meth
|
|||
emit('files:node:created', davResultToNode(data))
|
||||
}
|
||||
} 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)
|
||||
// if the user selected to keep the old file, and did not select the new file
|
||||
// that means they opted to delete the current node
|
||||
if (!selected.length && !renamed.length) {
|
||||
await client.deleteFile(currentPath)
|
||||
emit('files:node:deleted', node)
|
||||
return
|
||||
}
|
||||
} catch (error) {
|
||||
// User cancelled
|
||||
showError(t('files','Move cancelled'))
|
||||
return
|
||||
}
|
||||
}
|
||||
// getting here means either no conflict, file was renamed to keep both files
|
||||
// in a conflict, or the selected file was chosen to be kept during the conflict
|
||||
await client.moveFile(currentPath, join(destinationPath, node.basename))
|
||||
// Delete the node as it will be fetched again
|
||||
// when navigating to the destination folder
|
||||
|
|
|
|||
4
dist/comments-comments-app.js
vendored
4
dist/comments-comments-app.js
vendored
File diff suppressed because one or more lines are too long
2
dist/comments-comments-app.js.map
vendored
2
dist/comments-comments-app.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/comments-comments-tab.js
vendored
4
dist/comments-comments-tab.js
vendored
File diff suppressed because one or more lines are too long
2
dist/comments-comments-tab.js.map
vendored
2
dist/comments-comments-tab.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/core-common.js
vendored
4
dist/core-common.js
vendored
File diff suppressed because one or more lines are too long
2
dist/core-common.js.map
vendored
2
dist/core-common.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/files-init.js
vendored
4
dist/files-init.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files-init.js.map
vendored
2
dist/files-init.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/files-main.js
vendored
4
dist/files-main.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files-main.js.map
vendored
2
dist/files-main.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/systemtags-init.js
vendored
4
dist/systemtags-init.js
vendored
File diff suppressed because one or more lines are too long
2
dist/systemtags-init.js.map
vendored
2
dist/systemtags-init.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue