From becaa67cfc3d78af5d9fc0561b85ffa3445967b5 Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Fri, 14 Oct 2022 09:29:27 +0200 Subject: [PATCH] fix: file list update after copying resources --- changelog/unreleased/enhancement-id-based-routing | 1 + .../web-app-files/src/components/AppBar/CreateAndUpload.vue | 3 +-- .../src/components/FilesList/KeyboardActions.vue | 4 +--- .../web-app-files/src/helpers/resource/actions/transfer.ts | 4 +++- packages/web-app-files/src/mixins/actions/paste.js | 6 ++---- packages/web-app-files/src/store/actions.ts | 5 ++--- 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/changelog/unreleased/enhancement-id-based-routing b/changelog/unreleased/enhancement-id-based-routing index 328afa35a63..3bb0bcfa094 100644 --- a/changelog/unreleased/enhancement-id-based-routing +++ b/changelog/unreleased/enhancement-id-based-routing @@ -12,3 +12,4 @@ https://github.com/owncloud/web/issues/6247 https://github.com/owncloud/web/pull/7725 https://github.com/owncloud/web/issues/7714 https://github.com/owncloud/web/issues/7715 +https://github.com/owncloud/web/pull/7797 diff --git a/packages/web-app-files/src/components/AppBar/CreateAndUpload.vue b/packages/web-app-files/src/components/AppBar/CreateAndUpload.vue index 067d209a3f7..0997e5aaa16 100644 --- a/packages/web-app-files/src/components/AppBar/CreateAndUpload.vue +++ b/packages/web-app-files/src/components/AppBar/CreateAndUpload.vue @@ -324,8 +324,7 @@ export default defineComponent({ showMessage: this.showMessage, $gettext: this.$gettext, $gettextInterpolate: this.$gettextInterpolate, - $ngettext: this.$ngettext, - upsertResource: this.UPSERT_RESOURCE + $ngettext: this.$ngettext }).then(() => { ;(document.activeElement as HTMLElement).blur() }) diff --git a/packages/web-app-files/src/components/FilesList/KeyboardActions.vue b/packages/web-app-files/src/components/FilesList/KeyboardActions.vue index e0ed4590623..b328a2aba22 100644 --- a/packages/web-app-files/src/components/FilesList/KeyboardActions.vue +++ b/packages/web-app-files/src/components/FilesList/KeyboardActions.vue @@ -79,7 +79,6 @@ export default defineComponent({ 'toggleFileSelection' ]), ...mapMutations('Files', { - upsertResource: 'UPSERT_RESOURCE', setLatestSelectedFile: 'SET_LATEST_SELECTED_FILE_ID', setFileSelection: 'SET_FILE_SELECTION', addFileSelection: 'ADD_FILE_SELECTION' @@ -264,8 +263,7 @@ export default defineComponent({ showMessage: this.showMessage, $gettext: this.$gettext, $gettextInterpolate: this.$gettextInterpolate, - $ngettext: this.$ngettext, - upsertResource: this.upsertResource + $ngettext: this.$ngettext }) }, diff --git a/packages/web-app-files/src/helpers/resource/actions/transfer.ts b/packages/web-app-files/src/helpers/resource/actions/transfer.ts index 0ba0e2fd5a0..30db3eb9bb0 100644 --- a/packages/web-app-files/src/helpers/resource/actions/transfer.ts +++ b/packages/web-app-files/src/helpers/resource/actions/transfer.ts @@ -121,7 +121,7 @@ export class ResourceTransfer extends ConflictDialog { const movedResources: Resource[] = [] for (let resource of this.resourcesToMove) { - // shallow copy of resources to prevent modifing existing rows + // shallow copy of resources to prevent modifying existing rows resource = { ...resource } const hasConflict = resolvedConflicts.some((e) => e.resource.id === resource.id) let targetName = resource.name @@ -164,6 +164,8 @@ export class ResourceTransfer extends ConflictDialog { { path: join(this.targetFolder.path, targetName) }, { overwrite: overwriteTarget } ) + resource.id = undefined + resource.fileId = undefined } else if (transferType === TransferType.MOVE) { await this.clientService.webdav.moveFiles( this.sourceSpace, diff --git a/packages/web-app-files/src/mixins/actions/paste.js b/packages/web-app-files/src/mixins/actions/paste.js index 6e527bc07a9..c67f8d22eb0 100644 --- a/packages/web-app-files/src/mixins/actions/paste.js +++ b/packages/web-app-files/src/mixins/actions/paste.js @@ -3,7 +3,7 @@ import { isLocationPublicActive, isLocationSpacesActive } from '../../router' -import { mapActions, mapMutations, mapGetters } from 'vuex' +import { mapActions, mapGetters } from 'vuex' export default { computed: { @@ -58,7 +58,6 @@ export default { methods: { ...mapActions(['showMessage', 'createModal', 'hideModal']), ...mapActions('Files', ['pasteSelectedFiles']), - ...mapMutations('Files', ['UPSERT_RESOURCE']), $_paste_trigger() { this.pasteSelectedFiles({ @@ -69,8 +68,7 @@ export default { showMessage: this.showMessage, $gettext: this.$gettext, $gettextInterpolate: this.$gettextInterpolate, - $ngettext: this.$ngettext, - upsertResource: this.UPSERT_RESOURCE + $ngettext: this.$ngettext }) } } diff --git a/packages/web-app-files/src/store/actions.ts b/packages/web-app-files/src/store/actions.ts index a23e5372fef..c31c1163779 100644 --- a/packages/web-app-files/src/store/actions.ts +++ b/packages/web-app-files/src/store/actions.ts @@ -72,8 +72,7 @@ export default { showMessage, $gettext, $gettextInterpolate, - $ngettext, - upsertResource + $ngettext } ) { const copyMove = new ResourceTransfer( @@ -105,7 +104,7 @@ export default { targetSpace, resource ) - upsertResource(movedResource) + context.commit('UPSERT_RESOURCE', movedResource) })() ) }