From fc237c65066b80721392742651520b951e69f185 Mon Sep 17 00:00:00 2001 From: Jan Ackermann Date: Mon, 8 Apr 2024 14:08:51 +0200 Subject: [PATCH 01/11] Centrelize version loading --- .../SideBar/Details/FileDetails.vue | 34 ++----------------- .../SideBar/Versions/FileVersions.vue | 21 ++---------- .../src/components/SideBar/FileSideBar.vue | 16 +++++++++ 3 files changed, 20 insertions(+), 51 deletions(-) diff --git a/packages/web-app-files/src/components/SideBar/Details/FileDetails.vue b/packages/web-app-files/src/components/SideBar/Details/FileDetails.vue index b371f85d458..53df38e792f 100644 --- a/packages/web-app-files/src/components/SideBar/Details/FileDetails.vue +++ b/packages/web-app-files/src/components/SideBar/Details/FileDetails.vue @@ -174,18 +174,12 @@ export default defineComponent({ type: Boolean, required: false, default: true - }, - versionsEnabled: { - type: Boolean, - required: false, - default: true } }, setup(props) { const configStore = useConfigStore() const userStore = useUserStore() const capabilityStore = useCapabilityStore() - const clientService = useClientService() const { getMatchingSpace } = useGetMatchingSpace() const language = useGettext() @@ -196,6 +190,8 @@ export default defineComponent({ const { user } = storeToRefs(userStore) const resource = inject>('resource') + const versions = inject>('versions') + console.log(versions) const space = inject>('space') const previewService = usePreviewService() @@ -204,15 +200,6 @@ export default defineComponent({ const authStore = useAuthStore() const { publicLinkContextReady } = storeToRefs(authStore) - const versions = ref([]) - const loadVersions = async (fileId: Resource['fileId']) => { - try { - versions.value = await clientService.webdav.listFileVersions(fileId) - } catch (e) { - console.error(e) - } - } - const isPreviewEnabled = computed(() => { if (unref(resource).isFolder) { return false @@ -261,23 +248,6 @@ export default defineComponent({ return formatRelativeDateFromJSDate(new Date(date), language.current) } - watch( - resource, - () => { - if (unref(resource)) { - loadPreviewTask.perform(unref(resource)) - if ( - props.versionsEnabled && - !unref(resource).isFolder && - !unref(publicLinkContextReady) - ) { - loadVersions(unref(resource).fileId) - } - } - }, - { immediate: true } - ) - const contextualHelper = { isEnabled: configStore.options.contextHelpers, data: tagsHelper({ configStore }) diff --git a/packages/web-app-files/src/components/SideBar/Versions/FileVersions.vue b/packages/web-app-files/src/components/SideBar/Versions/FileVersions.vue index 220b1b5b4ee..577784c700d 100644 --- a/packages/web-app-files/src/components/SideBar/Versions/FileVersions.vue +++ b/packages/web-app-files/src/components/SideBar/Versions/FileVersions.vue @@ -1,7 +1,6 @@