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
This commit is contained in:
Vitalii 2023-04-17 17:53:54 +03:00 committed by Storj Robot
parent 771d2269ab
commit 3e93c53560
2 changed files with 8 additions and 13 deletions

View File

@ -562,12 +562,10 @@ export const makeFilesModule = (): FilesModule => ({
(file) => file.type === 'file', (file) => file.type === 'file',
); );
if (uploadedFiles.length === 1) { if (uploadedFiles.length === 1 && !path && state.openModalOnFirstUpload) {
if (state.openModalOnFirstUpload === true) { commit('setObjectPathForModal', params.Key);
commit('setObjectPathForModal', params.Key); const appStore = useAppStore();
const appStore = useAppStore(); appStore.updateActiveModal(MODALS.objectDetails);
appStore.updateActiveModal(MODALS.objectDetails);
}
} }
commit('finishUpload', params.Key); commit('finishUpload', params.Key);

View File

@ -423,13 +423,10 @@ export const useFilesStore = defineStore('files', () => {
(file) => file.type === 'file', (file) => file.type === 'file',
); );
if (uploadedFiles.length === 1) { if (uploadedFiles.length === 1 && !path && state.openModalOnFirstUpload) {
if (state.openModalOnFirstUpload) { state.objectPathForModal = params.Key;
state.objectPathForModal = params.Key; const appStore = useAppStore();
appStore.updateActiveModal(MODALS.objectDetails);
const appStore = useAppStore();
appStore.updateActiveModal(MODALS.objectDetails);
}
} }
state.uploading = state.uploading.filter((file) => file.Key !== params.Key); state.uploading = state.uploading.filter((file) => file.Key !== params.Key);