@xuda.io/account_module 1.2.1982 → 1.2.1984
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.
- package/index.mjs +17 -15
- 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 = '
|
|
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,20 +2797,9 @@ 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
|
|
|
2797
|
-
// find contact emails , set status to 1
|
|
2798
|
-
|
|
2799
2803
|
const emails = await db_module.find_app_couch_query(account_profile_info.app_id, {
|
|
2800
2804
|
selector: {
|
|
2801
2805
|
docType: 'email',
|
|
@@ -2822,8 +2826,6 @@ export const not_spam_contact = async function (req, job_id, headers) {
|
|
|
2822
2826
|
req.uid = email.uid;
|
|
2823
2827
|
req.email_id = email._id;
|
|
2824
2828
|
await email_module.process_pending_email(req, job_id, headers);
|
|
2825
|
-
|
|
2826
|
-
// await process_email(email.email_account_id, profile, uid, email._id, job_id, headers, null, true);
|
|
2827
2829
|
}
|
|
2828
2830
|
|
|
2829
2831
|
// const conversations = await db_module.find_app_couch_query(account_profile_info.app_id, {
|