@arcaelas/whatsapp 6.1.2 → 6.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -595,10 +595,16 @@ class WhatsApp {
|
|
|
595
595
|
if (doc.lid) {
|
|
596
596
|
await this.engine.set(`/lid/${doc.lid}`, (0, store_1.serialize)(doc.id));
|
|
597
597
|
}
|
|
598
|
-
|
|
598
|
+
// Una ficha que existía vacía y ahora tiene nombre es un cambio que el consumidor
|
|
599
|
+
// necesita: sin avisar, quien memorice el contacto sigue mostrando el número.
|
|
600
|
+
// A card that existed empty and now has a name is a change the consumer needs: without
|
|
601
|
+
// notifying, whoever memoized the contact keeps showing the bare number.
|
|
602
|
+
const changed = current && ['lid', 'name', 'notify', 'verified_name', 'img_url', 'status'].some((key) => current[key] !== doc[key]);
|
|
603
|
+
if (!current || changed) {
|
|
599
604
|
const person = new this.Contact(doc);
|
|
600
605
|
const cached_chat = (0, store_1.deserialize)(await this.engine.get(`/chat/${doc.id}`));
|
|
601
|
-
|
|
606
|
+
const chat = new this.Chat(cached_chat ?? { id: doc.id, name: person.name });
|
|
607
|
+
this.emit(current ? 'contact:updated' : 'contact:created', person, chat, this);
|
|
602
608
|
}
|
|
603
609
|
}
|
|
604
610
|
/** @internal */
|
|
@@ -556,10 +556,16 @@ export class WhatsApp {
|
|
|
556
556
|
if (doc.lid) {
|
|
557
557
|
await this.engine.set(`/lid/${doc.lid}`, serialize(doc.id));
|
|
558
558
|
}
|
|
559
|
-
|
|
559
|
+
// Una ficha que existía vacía y ahora tiene nombre es un cambio que el consumidor
|
|
560
|
+
// necesita: sin avisar, quien memorice el contacto sigue mostrando el número.
|
|
561
|
+
// A card that existed empty and now has a name is a change the consumer needs: without
|
|
562
|
+
// notifying, whoever memoized the contact keeps showing the bare number.
|
|
563
|
+
const changed = current && ['lid', 'name', 'notify', 'verified_name', 'img_url', 'status'].some((key) => current[key] !== doc[key]);
|
|
564
|
+
if (!current || changed) {
|
|
560
565
|
const person = new this.Contact(doc);
|
|
561
566
|
const cached_chat = deserialize(await this.engine.get(`/chat/${doc.id}`));
|
|
562
|
-
|
|
567
|
+
const chat = new this.Chat(cached_chat ?? { id: doc.id, name: person.name });
|
|
568
|
+
this.emit(current ? 'contact:updated' : 'contact:created', person, chat, this);
|
|
563
569
|
}
|
|
564
570
|
}
|
|
565
571
|
/** @internal */
|