@xuda.io/account_module 1.2.385 → 1.2.387
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 +12 -2
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1211,11 +1211,22 @@ export const get_contacts = async function (req) {
|
|
|
1211
1211
|
// requests_from = await db_module.find_couch_query('xuda_team', { selector: { docType: 'team_request', access_type: 'contact', team_req_stat: 2, team_req_from_uid: uid }, fields: ['_id', 'team_req_date', 'team_req_to_email', 'team_req_from_uid'] });
|
|
1212
1212
|
}
|
|
1213
1213
|
|
|
1214
|
+
for await (let doc of requests_to.docs) {
|
|
1215
|
+
if (doc.contact_uid) {
|
|
1216
|
+
const account_ret = await get_account_name({ uid_query: doc.contact_uid });
|
|
1217
|
+
if (account_ret.code < 0) {
|
|
1218
|
+
continue; // throw new Error(`account ${contact_uid} not found`);
|
|
1219
|
+
}
|
|
1220
|
+
doc.profile_avatar = account_ret.data.profile_avatar;
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1214
1224
|
return {
|
|
1215
1225
|
code: 1,
|
|
1216
1226
|
data: {
|
|
1217
1227
|
docs: [
|
|
1218
|
-
...requests_to.docs.map((e) => ({
|
|
1228
|
+
...requests_to.docs.map((e) => ({ docType: 'contact', date_created: e.team_req_date, email: [e.team_req_to_email], name: '', profile_avatar: _conf.anonymous_image_url, pending: true, uid: e.team_req_from_uid, team_req_id: e._id })),
|
|
1229
|
+
...requests_from.docs.map((e) => ({
|
|
1219
1230
|
docType: 'contact',
|
|
1220
1231
|
date_created: e.team_req_date,
|
|
1221
1232
|
email: [e.sender_account_info.email],
|
|
@@ -1225,7 +1236,6 @@ export const get_contacts = async function (req) {
|
|
|
1225
1236
|
team_req_from_uid: e.team_req_from_uid,
|
|
1226
1237
|
team_req_id: e._id,
|
|
1227
1238
|
})),
|
|
1228
|
-
...requests_from.docs.map((e) => ({ docType: 'contact', date_created: e.team_req_date, email: [e.team_req_to_email], name: '', profile_avatar: _conf.anonymous_image_url, pending: true, uid: e.team_req_from_uid, team_req_id: e._id })),
|
|
1229
1239
|
...contacts.docs,
|
|
1230
1240
|
],
|
|
1231
1241
|
},
|