From d97dae6a8745cf3962d853082e5791ff2f46990a Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Mon, 24 Jun 2019 11:47:43 -0700 Subject: [PATCH] Capture id after first save for incoming error messages --- js/background.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/js/background.js b/js/background.js index 525c8dfbb..fc597112c 100644 --- a/js/background.js +++ b/js/background.js @@ -1639,10 +1639,15 @@ return; } + const id = await window.Signal.Data.saveMessage(message.attributes, { + Message: Whisper.Message, + }); + message.set({ id }); await message.saveErrors(error || new Error('Error was null')); - const id = message.get('conversationId'); + + const conversationId = message.get('conversationId'); const conversation = await ConversationController.getOrCreateAndWait( - id, + conversationId, 'private' ); conversation.set({ @@ -1663,9 +1668,13 @@ ev.confirm(); } - await window.Signal.Data.updateConversation(id, conversation.attributes, { - Conversation: Whisper.Conversation, - }); + await window.Signal.Data.updateConversation( + conversationId, + conversation.attributes, + { + Conversation: Whisper.Conversation, + } + ); } throw error;