From 07fd984009c12d5c055cb69ef841894d917321d0 Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Fri, 15 Dec 2023 12:40:19 +0100 Subject: [PATCH] fix(shares): pass uploadId to failed temp message Signed-off-by: Maksim Sukharev --- src/store/fileUploadStore.js | 4 ++-- src/store/messagesStore.js | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/store/fileUploadStore.js b/src/store/fileUploadStore.js index 151264f2e16..a0479cf3a31 100644 --- a/src/store/fileUploadStore.js +++ b/src/store/fileUploadStore.js @@ -359,7 +359,7 @@ const actions = { // Mark the upload as failed in the store commit('markFileAsFailedUpload', { uploadId, index }) - dispatch('markTemporaryMessageAsFailed', { message: uploadedFile.temporaryMessage, reason }) + dispatch('markTemporaryMessageAsFailed', { message: uploadedFile.temporaryMessage, uploadId, reason }) } } @@ -387,7 +387,7 @@ const actions = { } else { showError(t('spreed', 'An error happened when trying to share your file')) } - dispatch('markTemporaryMessageAsFailed', { message: temporaryMessage, reason: 'failed-share' }) + dispatch('markTemporaryMessageAsFailed', { message: temporaryMessage, uploadId, reason: 'failed-share' }) console.error('An error happened when trying to share your file: ', error) } } diff --git a/src/store/messagesStore.js b/src/store/messagesStore.js index b9279e955c0..60983cbcc87 100644 --- a/src/store/messagesStore.js +++ b/src/store/messagesStore.js @@ -337,11 +337,15 @@ const mutations = { * @param {object} state current store state; * @param {object} data the wrapping object; * @param {object} data.message the temporary message; + * @param {string} data.uploadId the internal id of the upload; * @param {string} data.reason the reason the temporary message failed; */ - markTemporaryMessageAsFailed(state, { message, reason }) { + markTemporaryMessageAsFailed(state, { message, uploadId, reason }) { if (state.messages[message.token][message.id]) { Vue.set(state.messages[message.token][message.id], 'sendingFailure', reason) + if (uploadId) { + Vue.set(state.messages[message.token][message.id], 'uploadId', uploadId) + } } }, @@ -678,10 +682,11 @@ const actions = { * @param {object} context default store context; * @param {object} data the wrapping object; * @param {object} data.message the temporary message; + * @param {string} data.uploadId the internal id of the upload; * @param {string} data.reason the reason the temporary message failed; */ - markTemporaryMessageAsFailed(context, { message, reason }) { - context.commit('markTemporaryMessageAsFailed', { message, reason }) + markTemporaryMessageAsFailed(context, { message, uploadId, reason }) { + context.commit('markTemporaryMessageAsFailed', { message, uploadId, reason }) }, /**