@xuda.io/account_module 1.2.1641 → 1.2.1643

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.mjs +21 -10
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2094,16 +2094,22 @@ export const add_contact = async function (req, job_id, headers) {
2094
2094
  if (_.isEmpty(cached_contact)) {
2095
2095
  if (account_type === 'business' && !is_spam) {
2096
2096
  const business_info = await ai_module.get_business_info(uid, contact_obj.name, contact_obj.email, account_profile_info);
2097
- const { business_size, business_category, business_sub_category, business_country, business_bio, business_name } = business_info;
2098
- contact_obj.mainCategory = business_category;
2099
- contact_obj.subCategory = business_sub_category;
2100
- contact_obj.business_size = business_size;
2101
- contact_obj.country = business_country;
2102
- contact_obj.bio = business_bio;
2103
- contact_obj.business_name = business_name;
2104
-
2097
+ if (business_info) {
2098
+ const { business_size, business_category, business_sub_category, business_country, business_bio, business_name } = business_info;
2099
+ contact_obj.mainCategory = business_category;
2100
+ contact_obj.subCategory = business_sub_category;
2101
+ contact_obj.business_size = business_size;
2102
+ contact_obj.country = business_country;
2103
+ contact_obj.bio = business_bio;
2104
+ contact_obj.business_name = business_name;
2105
+
2106
+ if (!contact_obj.name) {
2107
+ contact_obj.name = business_name;
2108
+ }
2109
+ }
2110
+ } else {
2105
2111
  if (!contact_obj.name) {
2106
- contact_obj.name = business_name;
2112
+ contact_obj.name = '';
2107
2113
  }
2108
2114
  }
2109
2115
 
@@ -2124,7 +2130,7 @@ export const add_contact = async function (req, job_id, headers) {
2124
2130
  }
2125
2131
  const save_ret = await save_contact(uid, contact_obj);
2126
2132
  save_xuda_cache(uid, 'contact', contact_obj.email, null, contact_obj);
2127
- if (!contact_obj.is_spam) {
2133
+ if (!contact_obj.is_spam && contact_obj.name) {
2128
2134
  set_contact_profile_picture(uid, contact_obj._id, metadata, job_id, headers);
2129
2135
  }
2130
2136
 
@@ -2368,6 +2374,11 @@ export const get_contacts = async function (req) {
2368
2374
  }
2369
2375
 
2370
2376
  contact_docs.docs.push(doc);
2377
+ if (contact_id) {
2378
+ if (doc.profile_avatar_stat === 1) {
2379
+ set_contact_profile_picture(uid, doc._id, {}, job_id, headers);
2380
+ }
2381
+ }
2371
2382
  }
2372
2383
 
2373
2384
  if (!contact_id && with_requests) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1641",
3
+ "version": "1.2.1643",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {