fix: window.WWebJS.getChatModel (#3587)

* fix: skip objects that don't have id

* fix: check for defined contact prop
This commit is contained in:
alechkos 2025-06-04 17:01:22 +03:00 • committed by GitHub
commit 755cb6ce73
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -556,8 +556,8 @@ exports.LoadUtils = () => {
const chatWid = window.Store.WidFactory.createWid(chat.id._serialized);
await window.Store.GroupMetadata.update(chatWid);
chat.groupMetadata.participants._models
.filter(x => x.id._serialized.endsWith('@lid'))
.forEach(x => { x.id = x.contact.phoneNumber; });
.filter(x => x.id?._serialized?.endsWith('@lid'))
.forEach(x => x.contact?.phoneNumber && (x.id = x.contact.phoneNumber));
model.groupMetadata = chat.groupMetadata.serialize();
model.isReadOnly = chat.groupMetadata.announce;
}