From 12f7577d79c54106bc42558de1a6ae4d1f28a3c6 Mon Sep 17 00:00:00 2001 From: Enzo William Date: Wed, 11 Mar 2026 15:48:15 -0300 Subject: [PATCH] fix: mentionsEveryOne always active even when set to false - Changed truthy check to strict equality (=== true) to properly handle string values like "false" sent by clients (e.g., n8n) - Fixed validation schema property name from 'everyOne' to 'mentionsEveryOne' to match DTO and service code Fixes #2431 Co-Authored-By: Claude Opus 4.5 --- .../whatsapp/whatsapp.baileys.service.ts | 2 +- src/validate/message.schema.ts | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index 60e857fcc..12879d6d4 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -2372,7 +2372,7 @@ export class BaileysStartupService extends ChannelStartupService { throw new NotFoundException('Group not found'); } - if (options?.mentionsEveryOne) { + if (options?.mentionsEveryOne === true) { mentions = group.participants.map((participant) => participant.id); } else if (options?.mentioned?.length) { mentions = options.mentioned.map((mention) => { diff --git a/src/validate/message.schema.ts b/src/validate/message.schema.ts index d514c6199..d4771331e 100644 --- a/src/validate/message.schema.ts +++ b/src/validate/message.schema.ts @@ -77,7 +77,7 @@ export const textMessageSchema: JSONSchema7 = { description: 'Enter a value in milliseconds', }, quoted: { ...quotedOptionsSchema }, - everyOne: { type: 'boolean', enum: [true, false] }, + mentionsEveryOne: { type: 'boolean', enum: [true, false] }, mentioned: { type: 'array', minItems: 1, @@ -107,7 +107,7 @@ export const mediaMessageSchema: JSONSchema7 = { description: 'Enter a value in milliseconds', }, quoted: { ...quotedOptionsSchema }, - everyOne: { type: 'boolean', enum: [true, false] }, + mentionsEveryOne: { type: 'boolean', enum: [true, false] }, mentioned: { type: 'array', minItems: 1, @@ -133,7 +133,7 @@ export const ptvMessageSchema: JSONSchema7 = { description: 'Enter a value in milliseconds', }, quoted: { ...quotedOptionsSchema }, - everyOne: { type: 'boolean', enum: [true, false] }, + mentionsEveryOne: { type: 'boolean', enum: [true, false] }, mentioned: { type: 'array', minItems: 1, @@ -159,7 +159,7 @@ export const audioMessageSchema: JSONSchema7 = { description: 'Enter a value in milliseconds', }, quoted: { ...quotedOptionsSchema }, - everyOne: { type: 'boolean', enum: [true, false] }, + mentionsEveryOne: { type: 'boolean', enum: [true, false] }, mentioned: { type: 'array', minItems: 1, @@ -209,7 +209,7 @@ export const stickerMessageSchema: JSONSchema7 = { description: 'Enter a value in milliseconds', }, quoted: { ...quotedOptionsSchema }, - everyOne: { type: 'boolean', enum: [true, false] }, + mentionsEveryOne: { type: 'boolean', enum: [true, false] }, mentioned: { type: 'array', minItems: 1, @@ -238,7 +238,7 @@ export const locationMessageSchema: JSONSchema7 = { description: 'Enter a value in milliseconds', }, quoted: { ...quotedOptionsSchema }, - everyOne: { type: 'boolean', enum: [true, false] }, + mentionsEveryOne: { type: 'boolean', enum: [true, false] }, mentioned: { type: 'array', minItems: 1, @@ -325,7 +325,7 @@ export const pollMessageSchema: JSONSchema7 = { description: 'Enter a value in milliseconds', }, quoted: { ...quotedOptionsSchema }, - everyOne: { type: 'boolean', enum: [true, false] }, + mentionsEveryOne: { type: 'boolean', enum: [true, false] }, mentioned: { type: 'array', minItems: 1, @@ -382,7 +382,7 @@ export const listMessageSchema: JSONSchema7 = { description: 'Enter a value in milliseconds', }, quoted: { ...quotedOptionsSchema }, - everyOne: { type: 'boolean', enum: [true, false] }, + mentionsEveryOne: { type: 'boolean', enum: [true, false] }, mentioned: { type: 'array', minItems: 1, @@ -433,7 +433,7 @@ export const buttonsMessageSchema: JSONSchema7 = { description: 'Enter a value in milliseconds', }, quoted: { ...quotedOptionsSchema }, - everyOne: { type: 'boolean', enum: [true, false] }, + mentionsEveryOne: { type: 'boolean', enum: [true, false] }, mentioned: { type: 'array', minItems: 1,