diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2020-11-06 22:06:54 +0300 |
---|---|---|
committer | Vincent Petry <vincent@nextcloud.com> | 2021-02-09 11:35:53 +0300 |
commit | 02feb9242ed55fb74542e9b2f615cea1fb2a4126 (patch) | |
tree | 312381447ff6abe67e987c1c6238a3b632b32603 | |
parent | f8dd0a2ae3ae7c5439eb21ae616880a32e0ba502 (diff) |
Clear state when starting or discarding uploads
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 <danxuliu@gmail.com>
-rw-r--r-- | src/store/fileUploadStore.js | 10 |
1 files changed, 10 insertions, 0 deletions
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 |