From 3e93c535608ab1421ace166956cec86050de8d20 Mon Sep 17 00:00:00 2001 From: Vitalii Date: Mon, 17 Apr 2023 17:53:54 +0300 Subject: [PATCH] web/satellite: fix object browser auto preview feature Fix for an issue: uploading folder triggers object preview modal to show up if there is already and only 1 uploaded object in this bucket. By this fix we check if uploading object has prefix (basically folder) so we don't trigger object preview automatically. Change-Id: I32943ef81c19d4ba1960ecb2f15126dfb381d845 --- web/satellite/src/store/modules/files.ts | 10 ++++------ web/satellite/src/store/modules/objectBrowserStore.ts | 11 ++++------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/web/satellite/src/store/modules/files.ts b/web/satellite/src/store/modules/files.ts index 236f9a302..c418d84e7 100644 --- a/web/satellite/src/store/modules/files.ts +++ b/web/satellite/src/store/modules/files.ts @@ -562,12 +562,10 @@ export const makeFilesModule = (): FilesModule => ({ (file) => file.type === 'file', ); - if (uploadedFiles.length === 1) { - if (state.openModalOnFirstUpload === true) { - commit('setObjectPathForModal', params.Key); - const appStore = useAppStore(); - appStore.updateActiveModal(MODALS.objectDetails); - } + if (uploadedFiles.length === 1 && !path && state.openModalOnFirstUpload) { + commit('setObjectPathForModal', params.Key); + const appStore = useAppStore(); + appStore.updateActiveModal(MODALS.objectDetails); } commit('finishUpload', params.Key); diff --git a/web/satellite/src/store/modules/objectBrowserStore.ts b/web/satellite/src/store/modules/objectBrowserStore.ts index b8754be74..e6b39294f 100644 --- a/web/satellite/src/store/modules/objectBrowserStore.ts +++ b/web/satellite/src/store/modules/objectBrowserStore.ts @@ -423,13 +423,10 @@ export const useFilesStore = defineStore('files', () => { (file) => file.type === 'file', ); - if (uploadedFiles.length === 1) { - if (state.openModalOnFirstUpload) { - state.objectPathForModal = params.Key; - - const appStore = useAppStore(); - appStore.updateActiveModal(MODALS.objectDetails); - } + if (uploadedFiles.length === 1 && !path && state.openModalOnFirstUpload) { + state.objectPathForModal = params.Key; + const appStore = useAppStore(); + appStore.updateActiveModal(MODALS.objectDetails); } state.uploading = state.uploading.filter((file) => file.Key !== params.Key);