@xuda.io/account_module 1.2.2137 → 1.2.2139
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 -7
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2332,7 +2332,7 @@ export const get_contacts = async function (req, job_id, headers) {
|
|
|
2332
2332
|
let contact_docs = { docs: [], total_docs: contacts.total_docs };
|
|
2333
2333
|
|
|
2334
2334
|
const chat_conversation_count = async function () {
|
|
2335
|
-
const account_profile_info = await get_active_account_profile_info(uid);
|
|
2335
|
+
// const account_profile_info = await get_active_account_profile_info(uid);
|
|
2336
2336
|
|
|
2337
2337
|
const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'conversations_item_counts', {
|
|
2338
2338
|
reduce: true,
|
|
@@ -2352,20 +2352,25 @@ export const get_contacts = async function (req, job_id, headers) {
|
|
|
2352
2352
|
return counts;
|
|
2353
2353
|
};
|
|
2354
2354
|
const chat_conversation_read = async function () {
|
|
2355
|
-
const account_profile_info = await get_active_account_profile_info(uid);
|
|
2355
|
+
// const account_profile_info = await get_active_account_profile_info(uid);
|
|
2356
2356
|
|
|
2357
2357
|
const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_read', {
|
|
2358
2358
|
reduce: true,
|
|
2359
|
-
group_level:
|
|
2359
|
+
group_level: 999,
|
|
2360
2360
|
|
|
2361
|
-
startkey: [uid,
|
|
2362
|
-
endkey: [uid,
|
|
2361
|
+
startkey: [uid, '', ''],
|
|
2362
|
+
endkey: [uid, '', 'zzzzzz'],
|
|
2363
2363
|
});
|
|
2364
2364
|
|
|
2365
|
-
|
|
2365
|
+
let counts = {};
|
|
2366
|
+
for (const val of counts_ret?.rows) {
|
|
2367
|
+
counts[val.key[2]] = val.value;
|
|
2368
|
+
}
|
|
2369
|
+
return counts;
|
|
2366
2370
|
};
|
|
2367
2371
|
|
|
2368
2372
|
const contact_chat_conversation_count_ret = await chat_conversation_count();
|
|
2373
|
+
const contact_chat_conversation_read_ret = await chat_conversation_read();
|
|
2369
2374
|
debugger;
|
|
2370
2375
|
for await (let doc of contacts.docs) {
|
|
2371
2376
|
const ret_to = requests_to.docs.find((e) => {
|
|
@@ -2381,7 +2386,7 @@ export const get_contacts = async function (req, job_id, headers) {
|
|
|
2381
2386
|
doc = await get_contact_info(uid, doc);
|
|
2382
2387
|
|
|
2383
2388
|
doc.interactions = contact_chat_conversation_count_ret[doc._id];
|
|
2384
|
-
|
|
2389
|
+
doc.notifications = contact_chat_conversation_count_ret[doc._id] - contact_chat_conversation_read_ret[doc._id];
|
|
2385
2390
|
doc.chats = doc.interactions;
|
|
2386
2391
|
|
|
2387
2392
|
if (filter_type === 'online') {
|