mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-11 02:49:36 -06:00
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.
This commit is contained in:
parent
53a94af3f7
commit
08a4795016
@ -839,9 +839,8 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
this.sendDataWebhook(Events.CONTACTS_UPDATE, updatedContacts);
|
this.sendDataWebhook(Events.CONTACTS_UPDATE, updatedContacts);
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
updatedContacts.map(async (contact) => {
|
updatedContacts.map(async (contact) => {
|
||||||
let update;
|
|
||||||
if (this.configService.get<Database>('DATABASE').SAVE_DATA.CONTACTS) {
|
if (this.configService.get<Database>('DATABASE').SAVE_DATA.CONTACTS) {
|
||||||
update = this.prismaRepository.contact.updateMany({
|
await this.prismaRepository.contact.updateMany({
|
||||||
where: { remoteJid: contact.remoteJid, instanceId: this.instanceId },
|
where: { remoteJid: contact.remoteJid, instanceId: this.instanceId },
|
||||||
data: { profilePicUrl: contact.profilePicUrl },
|
data: { profilePicUrl: contact.profilePicUrl },
|
||||||
});
|
});
|
||||||
@ -865,8 +864,6 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
avatar_url: contact.profilePicUrl,
|
avatar_url: contact.profilePicUrl,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return update;
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user