Skip to content

Commit

Permalink
fix(shares): pass uploadId to failed temp message
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <[email protected]>
  • Loading branch information
Antreesy committed Dec 15, 2023
1 parent 00e9620 commit 07fd984
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/store/fileUploadStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
}
}

Expand Down Expand Up @@ -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)
}
}
Expand Down
11 changes: 8 additions & 3 deletions src/store/messagesStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
},

Expand Down Expand Up @@ -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 })
},

/**
Expand Down

0 comments on commit 07fd984

Please sign in to comment.