@xuda.io/account_module 1.2.1518 → 1.2.1520
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 +1 -45
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1702,51 +1702,6 @@ export const get_user_name = async function (uid) {
|
|
|
1702
1702
|
}
|
|
1703
1703
|
};
|
|
1704
1704
|
|
|
1705
|
-
// TBD
|
|
1706
|
-
export const update_contacts_with_account_changes = async function (uid, changes = []) {
|
|
1707
|
-
try {
|
|
1708
|
-
if (!changes.length) return;
|
|
1709
|
-
const ret = await db_module.get_couch_doc('xuda_accounts', uid);
|
|
1710
|
-
var account_obj = ret.data;
|
|
1711
|
-
account_obj.ts = Date.now();
|
|
1712
|
-
|
|
1713
|
-
// update all uid contacts with the new avatar
|
|
1714
|
-
const opt = {
|
|
1715
|
-
selector: { contact_uid: uid, docType: 'contact' },
|
|
1716
|
-
};
|
|
1717
|
-
debugger;
|
|
1718
|
-
let changes_made;
|
|
1719
|
-
var contacts = await db_module.find_couch_query('xuda_contacts', opt);
|
|
1720
|
-
for (let doc of contacts.docs) {
|
|
1721
|
-
if (changes.includes('profile_picture')) {
|
|
1722
|
-
changes_made = true;
|
|
1723
|
-
doc.profile_picture = account_obj.account_info.profile_picture;
|
|
1724
|
-
}
|
|
1725
|
-
if (changes.includes('profile_avatar')) {
|
|
1726
|
-
changes_made = true;
|
|
1727
|
-
doc.profile_avatar = account_obj.account_info.profile_avatar;
|
|
1728
|
-
}
|
|
1729
|
-
if (changes.includes('email')) {
|
|
1730
|
-
changes_made = true;
|
|
1731
|
-
doc.email = account_obj.account_info.email;
|
|
1732
|
-
}
|
|
1733
|
-
if (changes.includes('first_name') || changes.includes('last_name')) {
|
|
1734
|
-
changes_made = true;
|
|
1735
|
-
doc.name = `${account_obj.account_info.first_name} ${account_obj.account_info.last_name}`;
|
|
1736
|
-
}
|
|
1737
|
-
|
|
1738
|
-
console.log(doc);
|
|
1739
|
-
}
|
|
1740
|
-
if (contacts.docs && changes_made) {
|
|
1741
|
-
await db_module.save_couch_bulk_docs('xuda_contacts', contacts.docs);
|
|
1742
|
-
}
|
|
1743
|
-
|
|
1744
|
-
return username;
|
|
1745
|
-
} catch (err) {
|
|
1746
|
-
return 'unknown';
|
|
1747
|
-
}
|
|
1748
|
-
};
|
|
1749
|
-
|
|
1750
1705
|
export const get_user_card = async function (uid, uid_query) {
|
|
1751
1706
|
if (uid === uid_query) return await get_user_contact(uid, uid_query);
|
|
1752
1707
|
|
|
@@ -3036,6 +2991,7 @@ export const save_picture_cache = async function (uid, docType, name, file, meta
|
|
|
3036
2991
|
file,
|
|
3037
2992
|
date_created_ts: Date.now(),
|
|
3038
2993
|
metadata,
|
|
2994
|
+
hits: 0,
|
|
3039
2995
|
};
|
|
3040
2996
|
const save_ret = await db_module.save_couch_doc('xuda_cache', doc);
|
|
3041
2997
|
return save_ret;
|