Skip to content

Commit 08a4795

Browse files
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.
1 parent 53a94af commit 08a4795

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -839,9 +839,8 @@ export class BaileysStartupService extends ChannelStartupService {
839839
this.sendDataWebhook(Events.CONTACTS_UPDATE, updatedContacts);
840840
await Promise.all(
841841
updatedContacts.map(async (contact) => {
842-
let update;
843842
if (this.configService.get<Database>('DATABASE').SAVE_DATA.CONTACTS) {
844-
update = this.prismaRepository.contact.updateMany({
843+
await this.prismaRepository.contact.updateMany({
845844
where: { remoteJid: contact.remoteJid, instanceId: this.instanceId },
846845
data: { profilePicUrl: contact.profilePicUrl },
847846
});
@@ -865,8 +864,6 @@ export class BaileysStartupService extends ChannelStartupService {
865864
avatar_url: contact.profilePicUrl,
866865
});
867866
}
868-
869-
return update;
870867
}),
871868
);
872869
}

0 commit comments

Comments
 (0)