@xuda.io/account_module 1.2.1651 → 1.2.1653

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