diff --git a/src/global/actions/ui/messages.ts b/src/global/actions/ui/messages.ts index 1eb5f6139..f26b19740 100644 --- a/src/global/actions/ui/messages.ts +++ b/src/global/actions/ui/messages.ts @@ -632,6 +632,7 @@ addActionHandler('createServiceNotification', (global, actions, payload) => { // The fractional ID is made of the largest integer ID and an incremented fractional part const id = Math.floor(maxId) + fractionalPart; + message.previousLocalId = message.id; message.id = id; const serviceNotification = { diff --git a/src/global/helpers/messages.ts b/src/global/helpers/messages.ts index cda288a16..c983fe89b 100644 --- a/src/global/helpers/messages.ts +++ b/src/global/helpers/messages.ts @@ -23,9 +23,9 @@ export function getMessageHtmlId(messageId: number) { } export function getMessageKey(message: ApiMessage): MessageKey { - const { chatId, id } = message; + const { chatId, id, previousLocalId } = message; - return buildMessageKey(chatId, id); + return buildMessageKey(chatId, isServiceNotificationMessage(message) ? previousLocalId || id : id); } export function buildMessageKey(chatId: string, msgId: number): MessageKey {