@xuda.io/account_module 1.2.1651 → 1.2.1652

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 +5 -3
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2141,7 +2141,7 @@ export const add_contact = async function (req, job_id, headers) {
2141
2141
  };
2142
2142
 
2143
2143
  const set_contact_profile_picture = async function (uid, contact_id, metadata, job_id, headers) {
2144
- debugger;
2144
+
2145
2145
  const ai_module = await import(`${module_path}/ai_module/index.mjs`);
2146
2146
  const account_profile_info = await get_active_account_profile_info(uid);
2147
2147
 
@@ -2234,6 +2234,7 @@ const update_account_profile_picture_status = async function (uid, stat, error)
2234
2234
  let doc = await db_module.get_couch_doc_native('xuda_accounts', uid);
2235
2235
  doc.account_info.profile_avatar_stat = stat;
2236
2236
  doc.account_info.profile_avatar_error = error;
2237
+ doc.account_info.profile_avatar_stat_ts=Date.now()
2237
2238
  const save_ret = await db_module.save_couch_doc_native('xuda_accounts', doc);
2238
2239
  } catch (err) {
2239
2240
  console.error(err);
@@ -2246,6 +2247,7 @@ const update_contact_profile_picture_status = async function (uid, contact_id, s
2246
2247
  let doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, contact_id);
2247
2248
  doc.profile_avatar_stat = stat;
2248
2249
  doc.profile_avatar_error = error;
2250
+ doc.profile_avatar_stat_ts=Date.now()
2249
2251
 
2250
2252
  const save_ret = await db_module.save_app_couch_doc_native(account_profile_info.app_id, doc);
2251
2253
  } catch (err) {
@@ -2376,8 +2378,8 @@ export const get_contacts = async function (req, job_id, headers) {
2376
2378
  contact_docs.docs.push(doc);
2377
2379
 
2378
2380
  if (contact_id) {
2379
- if (doc.profile_avatar_stat === 2) debugger;
2380
- if (!doc.profile_avatar && (!doc.profile_avatar_stat || doc.profile_avatar_stat === 1)) {
2381
+
2382
+ if (!doc.profile_avatar && (!doc.profile_avatar_stat || doc.profile_avatar_stat === 1 || (doc.profile_avatar_stat === 2 && (!doc.profile_avatar_stat_ts || Date.now()-doc.profile_avatar_stat_ts>1000*60*5))) {
2381
2383
  set_contact_profile_picture(uid, doc._id, {}, job_id, headers);
2382
2384
  }
2383
2385
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1651",
3
+ "version": "1.2.1652",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {