diff options
author | Vincent Petry <vincent@nextcloud.com> | 2021-04-30 08:31:34 +0200 |
---|---|---|
committer | Vincent Petry <vincent@nextcloud.com> | 2021-04-30 08:42:41 +0200 |
commit | fe9cd12349b2c0d4c89b279d54e368b4824fa56d (patch) | |
tree | 48fec4f2b9b6c503ce6dad99000d43d1af62dbe2 /src/store | |
parent | c5e23656f5b5b9ac264dddcdf888beb5a11a5b20 (diff) |
Fix discard upload call + naming tweaks
DiscardUpload must pass args in the correct way.
Renamed fileId to temporaryMessageId for clarity.
Changed console.debug to console.error when sharing file for consistency
with the console.error from the upload.
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/fileUploadStore.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/store/fileUploadStore.js b/src/store/fileUploadStore.js index d0bd535c9..1f0385f16 100644 --- a/src/store/fileUploadStore.js +++ b/src/store/fileUploadStore.js @@ -170,16 +170,16 @@ const mutations = { state.currentUploadId = currentUploadId }, - removeFileFromSelection(state, fileId) { + removeFileFromSelection(state, temporaryMessageId) { const uploadId = state.currentUploadId for (const key in state.uploads[uploadId].files) { - if (state.uploads[uploadId].files[key].temporaryMessage.id === fileId) { + if (state.uploads[uploadId].files[key].temporaryMessage.id === temporaryMessageId) { Vue.delete(state.uploads[uploadId].files, key) } } }, - discardUpload(state, uploadId) { + discardUpload(state, { uploadId }) { Vue.delete(state.uploads, uploadId) }, } @@ -332,7 +332,7 @@ const actions = { message: temporaryMessage, reason: 'failed-share', }) - console.debug('An error happened when trying to share your file: ', error) + console.error('An error happened when trying to share your file: ', error) } } } @@ -371,8 +371,13 @@ const actions = { context.commit('markFileAsShared', { uploadId, index }) }, - removeFileFromSelection({ commit }, fileId) { - commit('removeFileFromSelection', fileId) + /** + * Mark a file as shared + * @param {object} context default store context; + * @param {string} temporaryMessageId message id of the temporary message associated to the file to remove + */ + removeFileFromSelection({ commit }, temporaryMessageId) { + commit('removeFileFromSelection', temporaryMessageId) }, } |