diff options
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 }, |