Skip to content

Commit 46c2918

Browse files
authored
fix: getContacts resolving all promisses (#201698)
* Fixing getContacts revolve all promisses Fixing getContacts revolve all promisses * Update Utils.js * Fixing getContactModel
1 parent cbf49be commit 46c2918

1 file changed

Lines changed: 12 additions & 18 deletions

File tree

src/util/Injected/Utils.js

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,11 +1026,7 @@ exports.LoadUtils = () => {
10261026
if (!res.isBlocked) {
10271027
const alt = window
10281028
.require('WAWebApiContact')
1029-
.getAlternateUserWid(
1030-
window
1031-
.require('WAWebWidFactory')
1032-
.asUserWidOrThrow(contact.id),
1033-
);
1029+
.getAlternateUserWid(wid);
10341030
if (alt) {
10351031
res.isBlocked = !!window
10361032
.require('WAWebCollections')
@@ -1080,19 +1076,17 @@ exports.LoadUtils = () => {
10801076
const contacts = window
10811077
.require('WAWebCollections')
10821078
.Contact.getModelsArray();
1083-
return contacts.map(async (contact) => {
1084-
if (contact.isBusiness || contact.isEnterprise) {
1085-
const contactWid = window
1086-
.require('WAWebWidFactory')
1087-
.createWid(contact.id);
1088-
const bizProfile = await window
1089-
.require('WAWebCollections')
1090-
.BusinessProfile.find(contactWid);
1091-
bizProfile.profileOptions &&
1092-
(contact.businessProfile = bizProfile);
1093-
}
1094-
return window.WWebJS.getContactModel(contact);
1095-
});
1079+
return Promise.all(
1080+
contacts.map(async (contact) => {
1081+
if (contact.isBusiness || contact.isEnterprise) {
1082+
await window
1083+
.require('WAWebCollections')
1084+
.BusinessProfile.find(contact.id)
1085+
.catch(() => {});
1086+
}
1087+
return window.WWebJS.getContactModel(contact);
1088+
}),
1089+
);
10961090
};
10971091

10981092
window.WWebJS.mediaInfoToFile = ({ data, mimetype, filename }) => {

0 commit comments

Comments
 (0)