Skip to content

Commit 4532ae9

Browse files
authored
fix: Fix/get contacts for biz contacts (#201680)
* Updated WWebJS.getContacts to handle business or enterprise contacts properly * Added missing return statement
1 parent 7f54af0 commit 4532ae9

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

src/util/Injected/Utils.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,9 +1080,19 @@ exports.LoadUtils = () => {
10801080
const contacts = window
10811081
.require('WAWebCollections')
10821082
.Contact.getModelsArray();
1083-
return contacts.map((contact) =>
1084-
window.WWebJS.getContactModel(contact),
1085-
);
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+
});
10861096
};
10871097

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

0 commit comments

Comments
 (0)