mirror of https://github.com/zulip/zulip.git
Track total number of unread messages
(imported from commit 0a6f270b8a4debf0cbb7e869ecbff59f39f22049)
This commit is contained in:
parent
bec83b2bc3
commit
37b5a84af4
|
@ -76,6 +76,7 @@ var globals =
|
|||
+ ' at_top_of_viewport at_bottom_of_viewport'
|
||||
+ ' viewport'
|
||||
+ ' load_more_messages reset_load_more_status have_scrolled_away_from_top'
|
||||
+ ' total_unread_messages'
|
||||
;
|
||||
|
||||
|
||||
|
|
|
@ -181,6 +181,7 @@ function message_range(start, end) {
|
|||
}
|
||||
|
||||
var unread_filters = {'stream': {}, 'private': {}};
|
||||
var total_unread_messages = 0;
|
||||
|
||||
// Record each message in the array 'messages' as either read or
|
||||
// unread, depending on the value of the 'is_read' flag.
|
||||
|
@ -209,8 +210,12 @@ function process_unread_counts(messages, is_read) {
|
|||
}
|
||||
});
|
||||
|
||||
$.each(unread_filters["stream"], function(index, obj) {
|
||||
ui.set_count("stream", index, Object.keys(obj).length);
|
||||
total_unread_messages = 0;
|
||||
|
||||
$.each(unread_filters.stream, function(index, obj) {
|
||||
var count = Object.keys(obj).length;
|
||||
ui.set_count("stream", index, count);
|
||||
total_unread_messages += count;
|
||||
});
|
||||
|
||||
var pm_count = 0;
|
||||
|
@ -218,6 +223,7 @@ function process_unread_counts(messages, is_read) {
|
|||
pm_count += Object.keys(obj).length;
|
||||
});
|
||||
ui.set_count("global", "private", pm_count);
|
||||
total_unread_messages += pm_count;
|
||||
}
|
||||
|
||||
function update_selected_message(message, opts) {
|
||||
|
|
Loading…
Reference in New Issue