From ea8b6509baecf09339d8ea95f8723b94774ab433 Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Wed, 21 Sep 2022 10:54:18 +0200 Subject: [PATCH] Fix missing information on share sidebar --- .../src/components/SideBar/SideBar.vue | 59 ++++++------------- .../src/components/SideBar/SpaceInfo.vue | 6 +- 2 files changed, 23 insertions(+), 42 deletions(-) diff --git a/packages/web-app-files/src/components/SideBar/SideBar.vue b/packages/web-app-files/src/components/SideBar/SideBar.vue index 6440de56aa9..b68408e981c 100644 --- a/packages/web-app-files/src/components/SideBar/SideBar.vue +++ b/packages/web-app-files/src/components/SideBar/SideBar.vue @@ -44,8 +44,7 @@ import { isLocationCommonActive, isLocationPublicActive, isLocationSharesActive, - isLocationSpacesActive, - isLocationTrashActive + isLocationSpacesActive } from '../../router' import { computed, defineComponent } from '@vue/composition-api' import { @@ -207,11 +206,8 @@ export default defineComponent({ watch: { highlightedFile: { handler(newFile, oldFile) { - if (!this.isSingleResource) { - return - } - - if (oldFile && isEqual(newFile, oldFile)) { + const noChanges = oldFile && isEqual(newFile, oldFile) + if (!this.isSingleResource || !this.highlightedFile || noChanges) { return } @@ -230,53 +226,34 @@ export default defineComponent({ deep: true } }, - async created() { - if (!this.areMultipleSelected) { - await this.fetchFileInfo(false) - } - }, methods: { ...mapActions('Files', ['loadSharesTree']), async fetchFileInfo(loadShares) { - if (!this.highlightedFile) { - this.selectedFile = {} - return + this.loading = true + const highlightedFileIsShare = + this.isSharedWithMeLocation || + this.isSharedWithOthersLocation || + this.isSharedViaLinkLocation + + if (loadShares) { + this.loadShares() } - if ( - isLocationTrashActive(this.$router, 'files-trash-personal') || - isLocationTrashActive(this.$router, 'files-trash-spaces-project') || - this.highlightedFileIsSpace - ) { - if (loadShares) { - this.loadShares() - } + if (!highlightedFileIsShare) { this.selectedFile = { ...this.highlightedFile } + this.loading = false return } - this.loading = true + // shared resources look different, hence we need to fetch the actual resource here try { - let item - if (isLocationPublicActive(this.$router, 'files-public-files')) { - item = await this.$client.publicFiles.getFileInfo( - this.highlightedFile.webDavPath, - this.publicLinkPassword, - DavProperties.PublicLink - ) - } else { - item = await this.$client.files.fileInfo( - this.highlightedFile.webDavPath, - DavProperties.Default - ) - } + const item = await this.$client.files.fileInfo( + this.highlightedFile.webDavPath, + DavProperties.Default + ) this.selectedFile = buildResource(item) - this.$set(this.selectedFile, 'thumbnail', this.highlightedFile.thumbnail || null) - if (loadShares) { - this.loadShares() - } } catch (error) { this.selectedFile = { ...this.highlightedFile } console.error(error) diff --git a/packages/web-app-files/src/components/SideBar/SpaceInfo.vue b/packages/web-app-files/src/components/SideBar/SpaceInfo.vue index 072de0467e2..871b590f7f7 100644 --- a/packages/web-app-files/src/components/SideBar/SpaceInfo.vue +++ b/packages/web-app-files/src/components/SideBar/SpaceInfo.vue @@ -17,12 +17,16 @@