Merge pull request #419 from judsonjuniorr/improvement/contacts-saving

Implement contact upsert in messaging-history.set
This commit is contained in:
Davidson Gomes 2024-02-12 19:59:21 -03:00 committed by GitHub
commit 525daff5fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1734,6 +1734,7 @@ export class WAStartupService {
{
messages,
chats,
contacts,
}: {
chats: Chat[];
contacts: Contact[];
@ -1846,6 +1847,17 @@ export class WAStartupService {
);
}
await this.contactHandle['contacts.upsert'](
contacts
.filter((c) => !!c.notify ?? !!c.name)
.map((c) => ({
id: c.id,
name: c.name ?? c.notify,
})),
database,
);
contacts = undefined;
messages = undefined;
chats = undefined;
} catch (error) {