From 719a57b2757c89a7bcf5abcf0f37292f3da59a1f Mon Sep 17 00:00:00 2001 From: Rajeh Taher Date: Sat, 5 Jul 2025 23:58:44 +0300 Subject: [PATCH] Added message range to the clear chat action (#1534) * chat-utils: Added message range to the clear chat action * Chat: add field to type (thanks @Kiss from discord) * Update src/Utils/chat-utils.ts --- src/Types/Chat.ts | 1 + src/Utils/chat-utils.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Types/Chat.ts b/src/Types/Chat.ts index f5d008a..c3542dd 100644 --- a/src/Types/Chat.ts +++ b/src/Types/Chat.ts @@ -94,6 +94,7 @@ export type ChatModification = } | { clear: boolean + lastMessages: LastMessageList } | { deleteForMe: { deleteMedia: boolean; key: WAMessageKey; timestamp: number } diff --git a/src/Utils/chat-utils.ts b/src/Utils/chat-utils.ts index 3556591..2a1f0b6 100644 --- a/src/Utils/chat-utils.ts +++ b/src/Utils/chat-utils.ts @@ -584,7 +584,9 @@ export const chatModificationToAppPatch = (mod: ChatModification, jid: string) = } else if ('clear' in mod) { patch = { syncAction: { - clearChatAction: {} // add message range later + clearChatAction: { + messageRange: getMessageRange(mod.lastMessages) + } }, index: ['clearChat', jid, '1' /*the option here is 0 when keep starred messages is enabled*/, '0'], type: 'regular_high',