From 08a479501644f1ac7b8e94cb1a06a3cdbb73e4c9 Mon Sep 17 00:00:00 2001 From: Gabriel Mouallem Date: Sun, 23 Nov 2025 23:09:42 -0300 Subject: [PATCH] fix: respect DATABASE_SAVE_DATA_CONTACTS in contact updates - Added missing conditional checks for `DATABASE_SAVE_DATA_CONTACTS` in `contacts.upsert` and `contacts.update` handlers. - Fixed an issue where profile picture updates were attempting to save to the database even when disabled. - Fixed an unawaited promise in `contacts.upsert` to ensure database operations complete correctly. --- .../channel/whatsapp/whatsapp.baileys.service.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index f55661c0..6ca0722f 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -839,9 +839,8 @@ export class BaileysStartupService extends ChannelStartupService { this.sendDataWebhook(Events.CONTACTS_UPDATE, updatedContacts); await Promise.all( updatedContacts.map(async (contact) => { - let update; if (this.configService.get('DATABASE').SAVE_DATA.CONTACTS) { - update = this.prismaRepository.contact.updateMany({ + await this.prismaRepository.contact.updateMany({ where: { remoteJid: contact.remoteJid, instanceId: this.instanceId }, data: { profilePicUrl: contact.profilePicUrl }, }); @@ -865,8 +864,6 @@ export class BaileysStartupService extends ChannelStartupService { avatar_url: contact.profilePicUrl, }); } - - return update; }), ); }