Implement contact upsert in messaging-history.set

This commit is contained in:
Judson Cairo 2024-02-12 11:46:51 -03:00
parent 4bb81b9a41
commit b2c51b4b8c

View File

@ -1734,6 +1734,7 @@ export class WAStartupService {
{ {
messages, messages,
chats, chats,
contacts,
}: { }: {
chats: Chat[]; chats: Chat[];
contacts: Contact[]; 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; messages = undefined;
chats = undefined; chats = undefined;
} catch (error) { } catch (error) {