mirror of https://github.com/zulip/zulip.git
Filter out private messages in home view when counting in home unread
(imported from commit 6b42168e880269c8fe14f0e2eab98cf03b480f17)
This commit is contained in:
parent
279f0b9842
commit
23802bc278
|
@ -241,20 +241,23 @@ function update_unread_counts() {
|
|||
return valid.length;
|
||||
}
|
||||
|
||||
function only_in_home_view(msgids) {
|
||||
return $.grep(msgids, function (msgid) {
|
||||
return home_msg_list.get(msgid) !== undefined;
|
||||
});
|
||||
}
|
||||
|
||||
$.each(unread_counts.stream, function(index, obj) {
|
||||
var count = Object.keys(obj).length;
|
||||
ui.set_count("stream", index, count);
|
||||
if (narrow.stream_in_home(index)) {
|
||||
var in_home_view = $.grep(Object.keys(obj), function (msgid) {
|
||||
return home_msg_list.get(msgid) !== undefined;
|
||||
});
|
||||
home_unread_messages += newer_than_pointer_count(in_home_view);
|
||||
home_unread_messages += newer_than_pointer_count(only_in_home_view(Object.keys(obj)));
|
||||
}
|
||||
});
|
||||
|
||||
var pm_count = 0;
|
||||
$.each(unread_counts["private"], function(index, obj) {
|
||||
pm_count += newer_than_pointer_count(Object.keys(obj));
|
||||
pm_count += newer_than_pointer_count(only_in_home_view(Object.keys(obj)));
|
||||
});
|
||||
ui.set_count("global", "private", pm_count);
|
||||
home_unread_messages += pm_count;
|
||||
|
|
Loading…
Reference in New Issue