@xuda.io/account_module 1.2.934 → 1.2.936
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 +5 -3
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1894,12 +1894,14 @@ export const unpin_contact = async function (req) {
|
|
|
1894
1894
|
|
|
1895
1895
|
export const add_contact = async function (req, job_id, headers) {
|
|
1896
1896
|
try {
|
|
1897
|
-
const { uid, email, name, stat, contact_uid, context, source, team_req_id, metadata } = req;
|
|
1897
|
+
const { uid, email, name, stat, contact_uid, context, source, team_req_id, metadata = {} } = req;
|
|
1898
1898
|
const contact_ret = await db_module.get_couch_view_raw('xuda_contacts', 'contacts_by_user_email_address', { key: [uid, email] });
|
|
1899
1899
|
|
|
1900
1900
|
if (contact_ret.rows.length) {
|
|
1901
1901
|
throw new Error('contact already exist active or deleted');
|
|
1902
1902
|
}
|
|
1903
|
+
|
|
1904
|
+
let is_spam;
|
|
1903
1905
|
let account_info_ret;
|
|
1904
1906
|
if (contact_uid) {
|
|
1905
1907
|
account_info_ret = await get_account_name({ uid_query: contact_uid });
|
|
@@ -1907,8 +1909,8 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
1907
1909
|
throw new Error(`account ${contact_uid} not found`);
|
|
1908
1910
|
}
|
|
1909
1911
|
} else {
|
|
1910
|
-
if (subject && !metadata.is_sent) {
|
|
1911
|
-
|
|
1912
|
+
if (metadata.subject && !metadata.is_sent) {
|
|
1913
|
+
is_spam = await ai_module.is_spam_email(uid, email, metadata.subject);
|
|
1912
1914
|
}
|
|
1913
1915
|
}
|
|
1914
1916
|
const d = Date.now();
|