fix: getContacts resolving all promisses (#201698)
* Fixing getContacts revolve all promisses Fixing getContacts revolve all promisses * Update Utils.js * Fixing getContactModel
This commit is contained in:
parent
cbf49be9be
commit
46c2918ff3
1 changed files with 12 additions and 18 deletions
|
|
@ -1026,11 +1026,7 @@ exports.LoadUtils = () => {
|
||||||
if (!res.isBlocked) {
|
if (!res.isBlocked) {
|
||||||
const alt = window
|
const alt = window
|
||||||
.require('WAWebApiContact')
|
.require('WAWebApiContact')
|
||||||
.getAlternateUserWid(
|
.getAlternateUserWid(wid);
|
||||||
window
|
|
||||||
.require('WAWebWidFactory')
|
|
||||||
.asUserWidOrThrow(contact.id),
|
|
||||||
);
|
|
||||||
if (alt) {
|
if (alt) {
|
||||||
res.isBlocked = !!window
|
res.isBlocked = !!window
|
||||||
.require('WAWebCollections')
|
.require('WAWebCollections')
|
||||||
|
|
@ -1080,19 +1076,17 @@ exports.LoadUtils = () => {
|
||||||
const contacts = window
|
const contacts = window
|
||||||
.require('WAWebCollections')
|
.require('WAWebCollections')
|
||||||
.Contact.getModelsArray();
|
.Contact.getModelsArray();
|
||||||
return contacts.map(async (contact) => {
|
return Promise.all(
|
||||||
|
contacts.map(async (contact) => {
|
||||||
if (contact.isBusiness || contact.isEnterprise) {
|
if (contact.isBusiness || contact.isEnterprise) {
|
||||||
const contactWid = window
|
await window
|
||||||
.require('WAWebWidFactory')
|
|
||||||
.createWid(contact.id);
|
|
||||||
const bizProfile = await window
|
|
||||||
.require('WAWebCollections')
|
.require('WAWebCollections')
|
||||||
.BusinessProfile.find(contactWid);
|
.BusinessProfile.find(contact.id)
|
||||||
bizProfile.profileOptions &&
|
.catch(() => {});
|
||||||
(contact.businessProfile = bizProfile);
|
|
||||||
}
|
}
|
||||||
return window.WWebJS.getContactModel(contact);
|
return window.WWebJS.getContactModel(contact);
|
||||||
});
|
}),
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
window.WWebJS.mediaInfoToFile = ({ data, mimetype, filename }) => {
|
window.WWebJS.mediaInfoToFile = ({ data, mimetype, filename }) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue