Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(baileys): drop encrypted edits and comments as non-content

Yudhi Armyndharis77d8ffbafde1
diff --git a/src/engine/adapters/baileys-message-mapper.ts b/src/engine/adapters/baileys-message-mapper.ts
index ac6d663c7..f4e4add92 100644
--- a/src/engine/adapters/baileys-message-mapper.ts
+++ b/src/engine/adapters/baileys-message-mapper.ts
@@ -4,8 +4,8 @@ import { chatKind } from '../identity/wa-id';
/**
* Content types that change or annotate another message and carry nothing of their own: a poll vote,
* an in-chat pin, a keep-in-chat toggle, an album header (its photos arrive as their own messages), an
- * encrypted reaction and an event RSVP. Mapped, they would surface as a bodyless `unknown` message, so
- * the live and history paths drop them instead.
+ * encrypted reaction, an event RSVP, an encrypted edit (an event edit) and an encrypted comment. Mapped,
+ * they would surface as a bodyless `unknown` message, so the live and history paths drop them instead.
*/
export const BAILEYS_NON_CONTENT_TYPES: ReadonlySet<string> = new Set([
'pollUpdateMessage',
@@ -14,6 +14,8 @@ export const BAILEYS_NON_CONTENT_TYPES: ReadonlySet<string> = new Set([
'albumMessage',
'encReactionMessage',
'encEventResponseMessage',
+ 'secretEncryptedMessage',
+ 'encCommentMessage',
]);
/**
diff --git a/src/engine/adapters/baileys.adapter.spec.ts b/src/engine/adapters/baileys.adapter.spec.ts
index 0d6f47863..3493abf65 100644
--- a/src/engine/adapters/baileys.adapter.spec.ts
+++ b/src/engine/adapters/baileys.adapter.spec.ts
@@ -2245,6 +2245,8 @@ describe('BaileysAdapter inbound fan-out', () => {
['ALBUM', { albumMessage: { expectedImageCount: 2 } }],
['ENC_REACTION', { encReactionMessage: { targetMessageKey: { id: 'M1' } } }],
['EVENT_RSVP', { encEventResponseMessage: { eventCreationMessageKey: { id: 'EV1' } } }],
+ ['EVENT_EDIT', { secretEncryptedMessage: { targetMessageKey: { id: 'EV1' }, secretEncType: 1 } }],
+ ['ENC_COMMENT', { encCommentMessage: { targetMessageKey: { id: 'M1' } } }],
];
const batch = (fromMe: boolean) => [
...nonContent.map(([id, message]) => ({