From 705d4d31fdbfcfdc4a1f997c2864ce23176419ef Mon Sep 17 00:00:00 2001 From: Shir Serlui <70711723+shirser121@users.noreply.github.com> Date: Thu, 18 Aug 2022 19:20:30 +0300 Subject: [PATCH] Use getCommonGroups not contact (#1623) --- src/Client.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Client.js b/src/Client.js index b36eb96..d3c9bb4 100644 --- a/src/Client.js +++ b/src/Client.js @@ -989,7 +989,13 @@ class Client extends EventEmitter { */ async getCommonGroups(contactId) { const commonGroups = await this.pupPage.evaluate(async (contactId) => { - const contact = window.Store.Contact.get(contactId); + let contact = window.Store.Contact.get(contactId); + if (!contact) { + const wid = window.Store.WidFactory.createUserWid(contactId); + const chatConstructor = window.Store.Contact.getModelsArray().find(c=>!c.isGroup).constructor; + contact = new chatConstructor({id: wid}); + } + if (contact.commonGroups) { return contact.commonGroups.serialize(); }