Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
docs(wwjs): stop calling Reaction the one structure normalization misses (#778)
Yudhi Armyndharisf4555b223bc0
diff --git a/src/engine/adapters/whatsapp-web-js.adapter.ts b/src/engine/adapters/whatsapp-web-js.adapter.tsindex 6cd06f9b6..5cbdd7b4b 100644--- a/src/engine/adapters/whatsapp-web-js.adapter.ts+++ b/src/engine/adapters/whatsapp-web-js.adapter.ts@@ -645,9 +645,11 @@ export class WhatsAppWebJsAdapter extends EventEmitter implements IWhatsAppEnginthis.client.on('message_reaction', reaction => {try {- // `Reaction` assigns its keys straight through (`this.msgId = data.parentMsgKey`), so it is the- // one structure upstream's id normalization doesn't reach — on a WA Web build that renamed- // `_serialized` to `$1` (#747), `msgId._serialized` is undefined even with the backport applied.+ // `Reaction` assigns its keys straight through (`this.msgId = data.parentMsgKey`), which+ // upstream's id normalization doesn't reach: it covers structure constructors and `msg.id`,+ // not keys assigned straight through (`Message.protocolMessageKey` and `Reaction.id` are the+ // same pattern). On a WA Web build that renamed `_serialized` to `$1` (#747),+ // `msgId._serialized` is undefined even with the backport applied.// Read `$1` as a fallback, and fall back again to `''` (the same no-id sentinel Baileys uses)// rather than pass undefined on: `applyReaction` looks the message up by this id, and TypeORM// DROPS an undefined condition from the where-clause — which would match an arbitrary row and