Use getCommonGroups not contact (#1623)

This commit is contained in:
Shir Serlui
2022-08-18 19:20:30 +03:00
committed by GitHub
parent bd4df4cf75
commit 705d4d31fd

View File

@@ -989,7 +989,13 @@ class Client extends EventEmitter {
*/ */
async getCommonGroups(contactId) { async getCommonGroups(contactId) {
const commonGroups = await this.pupPage.evaluate(async (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) { if (contact.commonGroups) {
return contact.commonGroups.serialize(); return contact.commonGroups.serialize();
} }