From a24bdc8bd3f01d371502d7379c86aa76dfb8261e Mon Sep 17 00:00:00 2001 From: Jamie Kyle <113370520+jamiebuilds-signal@users.noreply.github.com> Date: Wed, 27 Sep 2023 12:42:38 -0700 Subject: [PATCH] Update last message on group call peek --- ts/state/ducks/calling.ts | 4 +++- ts/state/ducks/conversations.ts | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ts/state/ducks/calling.ts b/ts/state/ducks/calling.ts index 917bca6c8..d0ca15cfd 100644 --- a/ts/state/ducks/calling.ts +++ b/ts/state/ducks/calling.ts @@ -43,7 +43,7 @@ import type { ConversationChangedActionType, ConversationRemovedActionType, } from './conversations'; -import { getConversationCallMode } from './conversations'; +import { getConversationCallMode, updateLastMessage } from './conversations'; import * as log from '../../logging/log'; import { strictAssert } from '../../util/assert'; import { waitForOnline } from '../../util/waitForOnline'; @@ -402,6 +402,8 @@ const doGroupCallPeek = ( peekInfo: formattedPeekInfo, }, }); + + dispatch(updateLastMessage(conversationId)); }); }; diff --git a/ts/state/ducks/conversations.ts b/ts/state/ducks/conversations.ts index c6b989215..2735c9e96 100644 --- a/ts/state/ducks/conversations.ts +++ b/ts/state/ducks/conversations.ts @@ -1132,6 +1132,7 @@ export const actions = { unblurAvatar, updateConversationModelSharedGroups, updateGroupAttributes, + updateLastMessage, updateSharedGroups, verifyConversationsStoppingSend, }; @@ -4433,6 +4434,20 @@ function maybeUpdateSelectedMessageForDetails( }; } +export function updateLastMessage( + conversationId: string +): ThunkAction { + return async () => { + const conversationModel = window.ConversationController.get(conversationId); + if (conversationModel == null) { + throw new Error( + `updateLastMessage: Could not find conversation ${conversationId}` + ); + } + await conversationModel.updateLastMessage(); + }; +} + export function reducer( state: Readonly = getEmptyState(), action: Readonly<