fix(worker): reactorJid null guard, document reaction removal, restore comments

This commit is contained in:
2026-05-27 17:03:47 +05:30
parent f255ef91fb
commit 705bd177e8
2 changed files with 27 additions and 1 deletions
+10 -1
View File
@@ -22,7 +22,9 @@ export function normalizeMessage(
if (!key) return null;
const remoteJid = key.remoteJid ?? '';
// only group messages (group JIDs end with @g.us)
if (!remoteJid.endsWith('@g.us')) return null;
// skip our own outgoing messages
if (key.fromMe) return null;
if (!msg.message) return null;
@@ -49,7 +51,9 @@ export function normalizeReaction(
if (!key) return null;
const remoteJid = key.remoteJid ?? '';
// only group messages (group JIDs end with @g.us)
if (!remoteJid.endsWith('@g.us')) return null;
// skip our own outgoing messages
if (key.fromMe) return null;
const reaction = msg.message?.reactionMessage;
@@ -58,10 +62,15 @@ export function normalizeReaction(
const targetMsgId = reaction.key?.id;
if (!targetMsgId) return null;
// Ensure reactorJid is not empty (group message must have a participant)
const reactorJid = key.participant;
if (!reactorJid) return null;
return {
reactorJid: key.participant ?? '',
reactorJid,
targetMsgId,
sourceGroupJid: remoteJid,
// emoji is empty string ('') when reaction was removed (retraction)
emoji: reaction.text ?? '',
accountId,
};