feat: @lid support (#3571)
* fix: convert lid to wid in window.WWebJS.getChatModel * convert lid to wid in window.WWebJS.getContact
This commit is contained in:
parent
f41d1e2174
commit
dd257b2039
1 changed files with 7 additions and 1 deletions
|
|
@ -467,6 +467,9 @@ exports.LoadUtils = () => {
|
||||||
res.isGroup = true;
|
res.isGroup = true;
|
||||||
const chatWid = window.Store.WidFactory.createWid((chat.id._serialized));
|
const chatWid = window.Store.WidFactory.createWid((chat.id._serialized));
|
||||||
await window.Store.GroupMetadata.update(chatWid);
|
await window.Store.GroupMetadata.update(chatWid);
|
||||||
|
chat.groupMetadata.participants._models
|
||||||
|
.filter(x => x.id._serialized.endsWith('@lid'))
|
||||||
|
.forEach(x => { x.id = x.contact.phoneNumber; });
|
||||||
res.groupMetadata = chat.groupMetadata.serialize();
|
res.groupMetadata = chat.groupMetadata.serialize();
|
||||||
res.isReadOnly = chat.groupMetadata.announce;
|
res.isReadOnly = chat.groupMetadata.announce;
|
||||||
}
|
}
|
||||||
|
|
@ -559,7 +562,10 @@ exports.LoadUtils = () => {
|
||||||
|
|
||||||
window.WWebJS.getContact = async contactId => {
|
window.WWebJS.getContact = async contactId => {
|
||||||
const wid = window.Store.WidFactory.createWid(contactId);
|
const wid = window.Store.WidFactory.createWid(contactId);
|
||||||
const contact = await window.Store.Contact.find(wid);
|
let contact = await window.Store.Contact.find(wid);
|
||||||
|
if (contact.id._serialized.endsWith('@lid')) {
|
||||||
|
contact.id = contact.phoneNumber;
|
||||||
|
}
|
||||||
const bizProfile = await window.Store.BusinessProfile.fetchBizProfile(wid);
|
const bizProfile = await window.Store.BusinessProfile.fetchBizProfile(wid);
|
||||||
bizProfile.profileOptions && (contact.businessProfile = bizProfile);
|
bizProfile.profileOptions && (contact.businessProfile = bizProfile);
|
||||||
return window.WWebJS.getContactModel(contact);
|
return window.WWebJS.getContactModel(contact);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue