mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 09:27:43 +00:00
Unify calculation of unread-count for notifications and use it in the title bar
Fixes trac #1004 (imported from commit 6f04d1d3ded198b46cc2ff1733b94b5c17beb581)
This commit is contained in:
@@ -192,6 +192,20 @@ function send_queued_flags() {
|
||||
var unread_counts = {'stream': {}, 'private': {}};
|
||||
var home_unread_messages = 0;
|
||||
|
||||
function unread_in_current_view() {
|
||||
var unread = 0;
|
||||
if (!narrow.active()) {
|
||||
unread = home_unread_messages;
|
||||
} else {
|
||||
$.each(current_msg_list.all(), function (idx, msg) {
|
||||
if (message_unread(msg) && msg.id > current_msg_list.selected_id()) {
|
||||
unread += 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
return unread;
|
||||
}
|
||||
|
||||
function message_unread(message) {
|
||||
if (message === undefined) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user