diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2022-04-07 22:22:04 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2022-04-07 22:22:04 +0300 |
commit | 851ee71f3c8a33af071d1fcf69ed72e5c6f88692 (patch) | |
tree | 32ba9f5326504b8cbe2e880fa5d815d59b176885 /src | |
parent | 323d9b287518c9829f1fbfc2798bbad4ebc82f84 (diff) |
Do not re-enqueue outbox messages when they are sent
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/NewMessageModal.vue | 4 | ||||
-rw-r--r-- | src/store/mutations.js | 4 | ||||
-rw-r--r-- | src/store/outbox/actions.js | 6 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/components/NewMessageModal.vue b/src/components/NewMessageModal.vue index fef9585a5..0006201c6 100644 --- a/src/components/NewMessageModal.vue +++ b/src/components/NewMessageModal.vue @@ -97,9 +97,9 @@ export default { inReplyToMessageId: null, sendAt: Math.floor(now / 1000), // JS timestamp is in milliseconds } - // TODO: update the message instead of enqueing another time - const message = await this.$store.dispatch('outbox/enqueueMessage', { + const message = await this.$store.dispatch('outbox/updateMessage', { message: dataForServer, + id: this.composerData.id, }) await this.$store.dispatch('outbox/sendMessage', { id: message.id }) diff --git a/src/store/mutations.js b/src/store/mutations.js index 9bb71337e..34fa44984 100644 --- a/src/store/mutations.js +++ b/src/store/mutations.js @@ -183,6 +183,10 @@ export default { }, }) }, + convertComposerMessageToOutbox(state, { message }) { + Vue.set(state.newMessage, 'type', 'outbox') + Vue.set(state.newMessage.data, 'id', message.id) + }, hideMessageComposer(state) { Vue.delete(state, 'newMessage') }, diff --git a/src/store/outbox/actions.js b/src/store/outbox/actions.js index 114d410b3..c8a10f4ca 100644 --- a/src/store/outbox/actions.js +++ b/src/store/outbox/actions.js @@ -48,6 +48,12 @@ export default { async enqueueMessage({ commit }, { message }) { message = await OutboxService.enqueueMessage(message) commit('addMessage', { message }) + + // Future drafts/sends after an error should go through outbox logic + commit('convertComposerMessageToOutbox', { message }, { + root: true, + }) + return message }, |