@xuda.io/account_module 1.2.882 → 1.2.883
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 +16 -23
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1623,21 +1623,6 @@ export const get_contacts = async function (req) {
|
|
|
1623
1623
|
let requests_from = { docs: [] };
|
|
1624
1624
|
let shared_from = { docs: [] };
|
|
1625
1625
|
let my_contact = { docs: [] };
|
|
1626
|
-
if (!_id && with_requests) {
|
|
1627
|
-
if (filter_type === 'pending') {
|
|
1628
|
-
////// TO - OUT
|
|
1629
|
-
requests_to.docs = await get_pending_contact_out(uid);
|
|
1630
|
-
|
|
1631
|
-
////// FROM - IN
|
|
1632
|
-
requests_from.docs = await get_pending_contact_in(uid);
|
|
1633
|
-
shared_from.docs = await get_pending_share_contact_in(uid);
|
|
1634
|
-
}
|
|
1635
|
-
// my contact
|
|
1636
|
-
if (filter_type === 'all' && !search && contact_docs.docs.length) {
|
|
1637
|
-
const my_contact_doc = await get_user_contact(uid, uid);
|
|
1638
|
-
my_contact.docs = [my_contact_doc];
|
|
1639
|
-
}
|
|
1640
|
-
}
|
|
1641
1626
|
let contact_docs = { docs: [] };
|
|
1642
1627
|
for await (let doc of contacts.docs) {
|
|
1643
1628
|
const ret_to = requests_to.docs.find((e) => {
|
|
@@ -1645,14 +1630,6 @@ export const get_contacts = async function (req) {
|
|
|
1645
1630
|
});
|
|
1646
1631
|
if (ret_to) continue;
|
|
1647
1632
|
|
|
1648
|
-
// let reference_doc;
|
|
1649
|
-
// if (doc.shared_from_uid) {
|
|
1650
|
-
// reference_doc = _.cloneDeep(doc);
|
|
1651
|
-
// doc = await db_module.get_couch_doc_native('xuda_contacts', reference_doc.share_item_id);
|
|
1652
|
-
// doc.reference_doc = reference_doc;
|
|
1653
|
-
// doc._id = reference_doc._id;
|
|
1654
|
-
// }
|
|
1655
|
-
|
|
1656
1633
|
const ret_from = requests_from.docs.find((e) => {
|
|
1657
1634
|
return e.contact_uid === doc.contact_uid;
|
|
1658
1635
|
});
|
|
@@ -1662,6 +1639,22 @@ export const get_contacts = async function (req) {
|
|
|
1662
1639
|
contact_docs.docs.push(doc);
|
|
1663
1640
|
}
|
|
1664
1641
|
|
|
1642
|
+
if (!_id && with_requests) {
|
|
1643
|
+
if (filter_type === 'pending') {
|
|
1644
|
+
////// TO - OUT
|
|
1645
|
+
requests_to.docs = await get_pending_contact_out(uid);
|
|
1646
|
+
|
|
1647
|
+
////// FROM - IN
|
|
1648
|
+
requests_from.docs = await get_pending_contact_in(uid);
|
|
1649
|
+
shared_from.docs = await get_pending_share_contact_in(uid);
|
|
1650
|
+
}
|
|
1651
|
+
// my contact
|
|
1652
|
+
if (filter_type === 'all' && !search && contact_docs.docs.length) {
|
|
1653
|
+
const my_contact_doc = await get_user_contact(uid, uid);
|
|
1654
|
+
my_contact.docs = [my_contact_doc];
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1665
1658
|
return {
|
|
1666
1659
|
code: 1,
|
|
1667
1660
|
data: {
|