From dfae74de3751d091b5626da90d0df75381873eab Mon Sep 17 00:00:00 2001 From: icleitoncosta Date: Mon, 1 Jul 2024 13:02:18 -0300 Subject: [PATCH] fix: Fixed isStatusV3 error (close #2054) --- src/chat/functions/getMessageById.ts | 5 ++++- src/chat/functions/getQuotedMsgKey.ts | 7 ++++++- src/whatsapp/misc/Wid.ts | 4 ++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/chat/functions/getMessageById.ts b/src/chat/functions/getMessageById.ts index f8e98df69d..8ddf4d00c9 100644 --- a/src/chat/functions/getMessageById.ts +++ b/src/chat/functions/getMessageById.ts @@ -59,7 +59,10 @@ export async function getMessageById( let msg = MsgStore.get(msgKey); if (!msg) { - if (msgKey.remote.isStatusV3()) { + if ( + msgKey.remote?.toString()?.includes('status@broadcast') || + msgKey.remote?.isStatusV3() + ) { msg = StatusV3Store.getMyStatus().msgs.get(msgKey); } else { const chat = assertGetChat(msgKey.remote); diff --git a/src/chat/functions/getQuotedMsgKey.ts b/src/chat/functions/getQuotedMsgKey.ts index 2fed2a48da..20d33ff775 100644 --- a/src/chat/functions/getQuotedMsgKey.ts +++ b/src/chat/functions/getQuotedMsgKey.ts @@ -37,12 +37,17 @@ export function getQuotedMsgKey(msg: MsgModel): MsgKey { const remote = msg.quotedRemoteJid ? msg.quotedRemoteJid : msg.id.remote; const fromMe = getMyUserId()?.equals(msg.quotedParticipant) || false; + const isStatus = + typeof Wid.isStatusV3 === 'function' + ? Wid.isStatusV3(remote) + : Wid.isStatus(remote); + const quotedMsgId = new MsgKey({ id: msg.quotedStanzaID, fromMe: fromMe, remote: remote, participant: - Wid.isGroup(msg.from!) || Wid.isGroup(msg.to!) || Wid.isStatusV3(remote) + Wid.isGroup(msg.from!) || Wid.isGroup(msg.to!) || isStatus ? msg.quotedParticipant : undefined, }); diff --git a/src/whatsapp/misc/Wid.ts b/src/whatsapp/misc/Wid.ts index fb567a73e5..7f17b5a254 100644 --- a/src/whatsapp/misc/Wid.ts +++ b/src/whatsapp/misc/Wid.ts @@ -59,6 +59,8 @@ export declare class Wid { isStatusV3(): boolean; + isStatus(): boolean; + isUser(): boolean; isLid(): boolean; @@ -97,6 +99,8 @@ export declare class Wid { static isStatusV3(wid: string | Wid): boolean; + static isStatus(wid: string | Wid): boolean; + static isUser(wid: string | Wid): boolean; static isLid(wid: string | Wid): boolean;