Update last message on group call peek

This commit is contained in:
Jamie Kyle 2023-09-27 12:42:38 -07:00 committed by GitHub
parent 1cc478180e
commit a24bdc8bd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View file

@ -43,7 +43,7 @@ import type {
ConversationChangedActionType, ConversationChangedActionType,
ConversationRemovedActionType, ConversationRemovedActionType,
} from './conversations'; } from './conversations';
import { getConversationCallMode } from './conversations'; import { getConversationCallMode, updateLastMessage } from './conversations';
import * as log from '../../logging/log'; import * as log from '../../logging/log';
import { strictAssert } from '../../util/assert'; import { strictAssert } from '../../util/assert';
import { waitForOnline } from '../../util/waitForOnline'; import { waitForOnline } from '../../util/waitForOnline';
@ -402,6 +402,8 @@ const doGroupCallPeek = (
peekInfo: formattedPeekInfo, peekInfo: formattedPeekInfo,
}, },
}); });
dispatch(updateLastMessage(conversationId));
}); });
}; };

View file

@ -1132,6 +1132,7 @@ export const actions = {
unblurAvatar, unblurAvatar,
updateConversationModelSharedGroups, updateConversationModelSharedGroups,
updateGroupAttributes, updateGroupAttributes,
updateLastMessage,
updateSharedGroups, updateSharedGroups,
verifyConversationsStoppingSend, verifyConversationsStoppingSend,
}; };
@ -4433,6 +4434,20 @@ function maybeUpdateSelectedMessageForDetails(
}; };
} }
export function updateLastMessage(
conversationId: string
): ThunkAction<void, RootStateType, unknown, never> {
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( export function reducer(
state: Readonly<ConversationsStateType> = getEmptyState(), state: Readonly<ConversationsStateType> = getEmptyState(),
action: Readonly< action: Readonly<