From ed923836e12c79c815f7061b05a1bd7254802157 Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Fri, 6 May 2022 13:45:16 +0200 Subject: [PATCH] Load newly created files/folders via personal space --- .../src/components/AppBar/CreateAndUpload.vue | 45 +++++++++++++++++-- .../features/webUIFilesCopy/copy.feature | 2 +- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/packages/web-app-files/src/components/AppBar/CreateAndUpload.vue b/packages/web-app-files/src/components/AppBar/CreateAndUpload.vue index 085f0a2e14b..cc0ea12dfb0 100644 --- a/packages/web-app-files/src/components/AppBar/CreateAndUpload.vue +++ b/packages/web-app-files/src/components/AppBar/CreateAndUpload.vue @@ -399,7 +399,20 @@ export default defineComponent({ let resource if (this.isPersonalLocation) { - path = buildWebDavFilesPath(this.user.id, path) + if (this.hasShareJail) { + const graphClient = clientService.graphAuthenticated( + this.configuration.server, + this.getToken + ) + const userResponse = await graphClient.users.getMe() + if (!userResponse.data) { + console.error('graph.user.getMe() has no data') + return + } + path = buildWebDavSpacesPath(userResponse.data.id, path || '') + } else { + path = buildWebDavFilesPath(this.user.id, path) + } await this.$client.files.createFolder(path) resource = await this.$client.files.fileInfo(path, DavProperties.Default) } else if (this.isSpacesProjectLocation) { @@ -492,7 +505,20 @@ export default defineComponent({ let path = pathUtil.join(this.currentPath, fileName) if (this.isPersonalLocation) { - path = buildWebDavFilesPath(this.user.id, path) + if (this.hasShareJail) { + const graphClient = clientService.graphAuthenticated( + this.configuration.server, + this.getToken + ) + const userResponse = await graphClient.users.getMe() + if (!userResponse.data) { + console.error('graph.user.getMe() has no data') + return + } + path = buildWebDavSpacesPath(userResponse.data.id, path || '') + } else { + path = buildWebDavFilesPath(this.user.id, path) + } await this.$client.files.putFileContents(path, '') resource = await this.$client.files.fileInfo(path, DavProperties.Default) } else if (this.isSpacesProjectLocation) { @@ -570,7 +596,20 @@ export default defineComponent({ let resource let path = pathUtil.join(this.currentPath, fileName) if (this.isPersonalLocation) { - path = buildWebDavFilesPath(this.user.id, path) + if (this.hasShareJail) { + const graphClient = clientService.graphAuthenticated( + this.configuration.server, + this.getToken + ) + const userResponse = await graphClient.users.getMe() + if (!userResponse.data) { + console.error('graph.user.getMe() has no data') + return + } + path = buildWebDavSpacesPath(userResponse.data.id, path || '') + } else { + path = buildWebDavFilesPath(this.user.id, path) + } resource = await this.$client.files.fileInfo(path, DavProperties.Default) } else if (this.isSpacesProjectLocation) { path = buildWebDavSpacesPath(this.$route.params.storageId, path) diff --git a/tests/acceptance/features/webUIFilesCopy/copy.feature b/tests/acceptance/features/webUIFilesCopy/copy.feature index 6050e58b6c2..fb335234dfb 100644 --- a/tests/acceptance/features/webUIFilesCopy/copy.feature +++ b/tests/acceptance/features/webUIFilesCopy/copy.feature @@ -84,7 +84,7 @@ Feature: copy files and folders And file "data.zip" should be listed on the webUI And as "Alice" file "simple-folder/simple-empty-folder/data.zip" should exist in the server And as "Alice" file "simple-folder/data.zip" should exist in the server -w + @issue-6892 Scenario: copy a file into another folder with no change permission Given user "Alice" has created file "lorem.txt" in the server