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<