From e5a9bf0f7c7820791004c778366c9362073b958a Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Mon, 21 Aug 2023 21:35:36 +0200 Subject: [PATCH] Fix sync messages for voice notes --- ts/state/ducks/conversations.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/ts/state/ducks/conversations.ts b/ts/state/ducks/conversations.ts index d653f6d03..140b8288c 100644 --- a/ts/state/ducks/conversations.ts +++ b/ts/state/ducks/conversations.ts @@ -1863,16 +1863,19 @@ export const markViewed = (messageId: string): void => { } const senderE164 = message.get('source'); - const senderAci = message.get('sourceServiceId'); - strictAssert( - isAciString(senderAci), - 'Message sourceServiceId must be an ACI' - ); const timestamp = getMessageSentTimestamp(message.attributes, { log }); message.set(messageUpdaterMarkViewed(message.attributes, Date.now())); + let senderAci: AciString; if (isIncoming(message.attributes)) { + const sourceServiceId = message.get('sourceServiceId'); + strictAssert( + isAciString(sourceServiceId), + 'Message sourceServiceId must be an ACI' + ); + senderAci = sourceServiceId; + const convoAttributes = message.getConversation()?.attributes; const conversationId = message.get('conversationId'); drop( @@ -1894,6 +1897,9 @@ export const markViewed = (messageId: string): void => { ], }) ); + } else { + // Use our own ACI for syncing viewed state of an outgoing message. + senderAci = window.textsecure.storage.user.getCheckedAci(); } drop(