Skip to content
Snippets Groups Projects
Commit 671856ab authored by echicken's avatar echicken :chicken:
Browse files

get-[sub,group]-unread-counts to fetch unread message counts

for every sub in a group or every group (that the user has
access to).
Avoids sending a long list of sub/group codes in the query string
for no good reason, which is a problem if you like to carry an
insane number of dead echoes or whatever.
parent ea1110e8
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -229,23 +229,31 @@ if (http_request.query.call !== undefined && (http_request.method === 'GET' || h ...@@ -229,23 +229,31 @@ if (http_request.query.call !== undefined && (http_request.method === 'GET' || h
case 'get-group-unread-count': case 'get-group-unread-count':
if (typeof http_request.query.group !== 'undefined') { if (typeof http_request.query.group !== 'undefined') {
http_request.query.group.forEach( http_request.query.group.forEach(function(group) {
function(group) { reply[group] = getGroupUnreadCount(group);
reply[group] = getGroupUnreadCount(group); });
}
);
} }
break; break;
case 'get-sub-unread-count': case 'get-sub-unread-count':
if (typeof http_request.query.sub !== 'undefined') { if (typeof http_request.query.sub !== 'undefined') {
http_request.query.sub.forEach( http_request.query.sub.forEach(function(sub) {
function(sub) { reply[sub] = getSubUnreadCount(sub);
reply[sub] = getSubUnreadCount(sub); });
} }
); break;
// Unread message counts for every sub in a group
case 'get-sub-unread-counts':
if (typeof http_request.query.group !== 'undefined' && msg_area.grp_list[http_request.query.group[0]]) {
reply = getSubUnreadCounts(http_request.query.group[0]);
} }
break; break;
// Unread message counts for all groups user has access to
case 'get-group-unread-counts':
reply = getGroupUnreadCounts();
break;
default: default:
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment