Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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 <[email protected]>
  • Loading branch information
danxuliu authored and PVince81 committed Feb 9, 2021
commit 02feb9242ed55fb74542e9b2f615cea1fb2a4126
10 changes: 10 additions & 0 deletions src/store/fileUploadStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
},

Expand All @@ -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
Expand Down