From 02feb9242ed55fb74542e9b2f615cea1fb2a4126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Fri, 6 Nov 2020 20:06:54 +0100 Subject: Clear state when starting or discarding uploads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The upload editor is shown based on both "showUploadEditor" (set in the store) and "modalDismissed" (set in the component). As "modalDismissed" is initially false and "showUploadEditor" was not cleared after an upload started or was discarded this caused the upload editor to be immediately shown if mounted again (for example, when joining a conversation in the Files app sidebar) if a previous upload was initialised. Signed-off-by: Daniel Calviño Sánchez --- src/store/fileUploadStore.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/store/fileUploadStore.js b/src/store/fileUploadStore.js index f094d9d2b..de0b5f5e6 100644 --- a/src/store/fileUploadStore.js +++ b/src/store/fileUploadStore.js @@ -220,6 +220,11 @@ const actions = { * @param {object} uploadId The unique uploadId */ discardUpload({ commit, state, getters }, uploadId) { + if (state.currentUploadId === uploadId) { + commit('setCurrentUploadId', undefined) + commit('showUploadEditor', false) + } + commit('discardUpload', { uploadId }) }, @@ -229,6 +234,11 @@ const actions = { * @param {object} uploadId The unique uploadId */ async uploadFiles({ commit, dispatch, state, getters }, uploadId) { + if (state.currentUploadId === uploadId) { + commit('setCurrentUploadId', undefined) + commit('showUploadEditor', false) + } + EventBus.$emit('uploadStart') // Tag the previously indexed files and add the temporary messages to the -- cgit v1.2.3