@xuda.io/account_module 1.2.407 → 1.2.409
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 -18
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1230,37 +1230,24 @@ export const get_contacts = async function (req) {
|
|
|
1230
1230
|
const requests_from_res = await db_module.find_couch_query('xuda_team', { selector: { docType: 'team_request', access_type: 'contact', team_req_stat: 2, team_req_to_uid: uid }, fields: ['_id', 'team_req_date', 'sender_account_info.email', 'team_req_from_uid'] });
|
|
1231
1231
|
|
|
1232
1232
|
for await (let e of requests_from_res.docs) {
|
|
1233
|
-
let doc = { docType: 'contact', date_created: e.team_req_date, email: [e.sender_account_info.email], name: '', pending: true, contact_uid: e.
|
|
1233
|
+
let doc = { docType: 'contact', date_created: e.team_req_date, email: [e.sender_account_info.email], name: '', pending: true, contact_uid: e.team_req_from_uid, team_req_id: e._id };
|
|
1234
1234
|
|
|
1235
|
-
if (e.
|
|
1236
|
-
const account_ret = await get_account_name({ uid_query: e.
|
|
1235
|
+
if (e.team_req_from_uid) {
|
|
1236
|
+
const account_ret = await get_account_name({ uid_query: e.team_req_from_uid });
|
|
1237
1237
|
if (account_ret.code < 0) {
|
|
1238
1238
|
continue; // throw new Error(`account ${contact_uid} not found`);
|
|
1239
1239
|
}
|
|
1240
1240
|
doc.profile_avatar = account_ret.data.profile_avatar;
|
|
1241
1241
|
doc.name = `${account_ret.data.first_name} ${account_ret.data.last_name}`;
|
|
1242
1242
|
}
|
|
1243
|
-
|
|
1243
|
+
requests_from.docs.push(doc);
|
|
1244
1244
|
}
|
|
1245
1245
|
}
|
|
1246
1246
|
|
|
1247
1247
|
return {
|
|
1248
1248
|
code: 1,
|
|
1249
1249
|
data: {
|
|
1250
|
-
docs: [
|
|
1251
|
-
...requests_to.docs,
|
|
1252
|
-
...requests_from.docs.map((e) => ({
|
|
1253
|
-
docType: 'contact',
|
|
1254
|
-
date_created: e.team_req_date,
|
|
1255
|
-
email: [e.sender_account_info.email],
|
|
1256
|
-
name: `${e.sender_account_info.first_name} ${e.sender_account_info.last_name}`,
|
|
1257
|
-
profile_avatar: e.sender_account_info.profile_avatar || _conf.anonymous_image_url,
|
|
1258
|
-
pending: true,
|
|
1259
|
-
team_req_from_uid: e.team_req_from_uid,
|
|
1260
|
-
team_req_id: e._id,
|
|
1261
|
-
})),
|
|
1262
|
-
...contacts.docs,
|
|
1263
|
-
],
|
|
1250
|
+
docs: [...requests_to.docs, ...requests_from, ...contacts.docs],
|
|
1264
1251
|
},
|
|
1265
1252
|
};
|
|
1266
1253
|
|