@xuda.io/account_module 1.2.1683 → 1.2.1685
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 +18 -2
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1292,7 +1292,20 @@ export const get_contact_info = async function (uid, contact_doc, _id) {
|
|
|
1292
1292
|
|
|
1293
1293
|
return counts_ret?.rows?.[0]?.value || 0;
|
|
1294
1294
|
};
|
|
1295
|
-
const
|
|
1295
|
+
const chat_conversation_read = async function () {
|
|
1296
|
+
const account_profile_info = await get_active_account_profile_info(uid);
|
|
1297
|
+
|
|
1298
|
+
const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_read', {
|
|
1299
|
+
reduce: true,
|
|
1300
|
+
group_level: 2,
|
|
1301
|
+
|
|
1302
|
+
startkey: [uid, doc._id, ''],
|
|
1303
|
+
endkey: [uid, doc._id, 'zzzzzz'],
|
|
1304
|
+
});
|
|
1305
|
+
|
|
1306
|
+
return counts_ret?.rows?.[0]?.value || 0;
|
|
1307
|
+
};
|
|
1308
|
+
|
|
1296
1309
|
doc.notifications = 0;
|
|
1297
1310
|
if (doc.contact_uid) {
|
|
1298
1311
|
const account_info_ret = await get_account_name({ uid_query: doc.contact_uid });
|
|
@@ -1360,8 +1373,11 @@ export const get_contact_info = async function (uid, contact_doc, _id) {
|
|
|
1360
1373
|
doc.email = doc.email;
|
|
1361
1374
|
}
|
|
1362
1375
|
|
|
1376
|
+
const contact_chat_conversation_count_ret = await chat_conversation_count();
|
|
1377
|
+
const contact_chat_conversation_read_ret = await chat_conversation_read();
|
|
1378
|
+
|
|
1363
1379
|
doc.interactions = contact_chat_conversation_count_ret;
|
|
1364
|
-
doc.notifications = contact_chat_conversation_count_ret;
|
|
1380
|
+
doc.notifications = contact_chat_conversation_count_ret - contact_chat_conversation_read_ret;
|
|
1365
1381
|
doc.chats = doc.interactions;
|
|
1366
1382
|
|
|
1367
1383
|
// const chats_ret = await ai_module.get_ai_chats({ uid, reference_id: doc._id });
|