@xuda.io/account_module 1.2.1983 → 1.2.1985

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 +18 -15
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2624,7 +2624,7 @@ export const delete_contact = async function (req, job_id, headers) {
2624
2624
  }
2625
2625
  };
2626
2626
 
2627
- export const unarchive_contact = async function (req) {
2627
+ export const unarchive_contact = async function (req, job_id, headers) {
2628
2628
  const { uid, contact_id } = req;
2629
2629
  try {
2630
2630
  var contact_doc = await get_contact(uid, contact_id);
@@ -2635,10 +2635,14 @@ export const unarchive_contact = async function (req) {
2635
2635
 
2636
2636
  contact_doc.stat = 3;
2637
2637
  contact_doc.stat_ts = Date.now();
2638
- contact_doc.stat_reason = 'archived by the user';
2638
+ contact_doc.stat_reason = 'unarchive by the user';
2639
2639
 
2640
2640
  const contact_save_ret = await save_contact(uid, contact_doc);
2641
2641
 
2642
+ if (!contact_doc.is_spam) {
2643
+ not_spam_contact(req, job_id, headers);
2644
+ }
2645
+
2642
2646
  return contact_save_ret;
2643
2647
  } catch (err) {
2644
2648
  return {
@@ -2766,6 +2770,17 @@ export const not_spam_contact = async function (req, job_id, headers) {
2766
2770
  const account_profile_info = await get_active_account_profile_info(uid);
2767
2771
  try {
2768
2772
  var contact_doc = await get_contact(uid, contact_id);
2773
+
2774
+ if (contact_doc.is_spam) {
2775
+ await db_module.save_couch_doc_native('xuda_accounts', {
2776
+ _id: await _common.xuda_get_uuid('spam_whitelist'),
2777
+ uid,
2778
+ docType: 'spam_whitelist',
2779
+ email: contact_doc.email,
2780
+ date_created_ts: Date.now(),
2781
+ stat: 3,
2782
+ });
2783
+ }
2769
2784
  contact_doc.is_spam = false;
2770
2785
 
2771
2786
  const is_business = await ai_module.is_business_contact(uid, contact_doc.email, contact_doc.name, contact_doc?.metadata?.subject, contact_doc?.metadata?.summarized_body, account_profile_info);
@@ -2782,15 +2797,6 @@ export const not_spam_contact = async function (req, job_id, headers) {
2782
2797
 
2783
2798
  const contact_save_ret = await save_contact(uid, contact_doc);
2784
2799
 
2785
- await db_module.save_couch_doc_native('xuda_accounts', {
2786
- _id: await _common.xuda_get_uuid('spam_whitelist'),
2787
- uid,
2788
- docType: 'spam_whitelist',
2789
- email: contact_doc.email,
2790
- date_created_ts: Date.now(),
2791
- stat: 3,
2792
- });
2793
-
2794
2800
  await delete_xuda_cache(contact_doc);
2795
2801
  set_contact_profile_picture(uid, contact_doc._id, {}, job_id, headers, account_profile_info, false);
2796
2802
 
@@ -2935,12 +2941,9 @@ export const set_deep_research_contact = async function (req, job_id, headers) {
2935
2941
  conversation_item.text = transcript?.data || transcript || '';
2936
2942
  conversation_item.process_stat = 'full';
2937
2943
  const conversation_item_save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, conversation_item);
2938
- debugger;
2939
2944
  }
2940
-
2941
- debugger;
2942
2945
  } catch (err) {
2943
- debugger;
2946
+ throw err;
2944
2947
  }
2945
2948
  }
2946
2949
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1983",
3
+ "version": "1.2.1985",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {