From 9c869148ef8bb0b4c35f84571f0f1dcb445d6282 Mon Sep 17 00:00:00 2001 From: Jamie Kyle <113370520+jamiebuilds-signal@users.noreply.github.com> Date: Wed, 21 Jun 2023 16:39:53 -0700 Subject: [PATCH] Never mark outgoing call message as unread --- ts/models/conversations.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ts/models/conversations.ts b/ts/models/conversations.ts index 830dc8d0d3dc..655312912aa4 100644 --- a/ts/models/conversations.ts +++ b/ts/models/conversations.ts @@ -3079,7 +3079,9 @@ export class ConversationModel extends window.Backbone assertDev(resolvedTime, 'Direct call must have accepted or ended time'); timestamp = resolvedTime; unread = - !callHistoryDetails.wasDeclined && !callHistoryDetails.acceptedTime; + callHistoryDetails.wasIncoming && + !callHistoryDetails.wasDeclined && + !callHistoryDetails.acceptedTime; detailsToSave = { ...callHistoryDetails, callMode: CallMode.Direct, @@ -3100,7 +3102,7 @@ export class ConversationModel extends window.Backbone this.queueJob('addCallHistory', async () => { // Force save if we're adding a new call history message for a direct call let forceSave = true; - let previousMessage: MessageAttributesType | void; + let previousMessage: MessageAttributesType | null = null; if (callHistoryDetails.callMode === CallMode.Direct) { const messageId = await window.Signal.Data.getCallHistoryMessageByCallId( @@ -3113,9 +3115,8 @@ export class ConversationModel extends window.Backbone ); // We don't want to force save if we're updating an existing message forceSave = false; - previousMessage = await window.Signal.Data.getMessageById( - messageId - ); + previousMessage = + (await window.Signal.Data.getMessageById(messageId)) ?? null; } else { log.info( `addCallHistory: No existing call history message found (Call ID: ${callHistoryDetails.callId})`