mirror of https://github.com/zulip/zulip.git
Fix narrowing not marking as unread when backfilling messages
(imported from commit 91b164251b0c2f97bf70c0051216347e2a4616eb)
This commit is contained in:
parent
9fb5487473
commit
ca0f414b60
|
@ -241,25 +241,29 @@ exports.activate = function (operators, opts) {
|
||||||
add_messages(all_msg_list.all(), narrowed_msg_list);
|
add_messages(all_msg_list.all(), narrowed_msg_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function mark_loaded_as_unread() {
|
||||||
|
// Mark as read any messages before or at the pointer in the narrowed view
|
||||||
|
if (! narrowed_msg_list.empty()) {
|
||||||
|
// XXX: We shouldn't really be directly accessing the message list
|
||||||
|
var msgs = narrowed_msg_list.all();
|
||||||
|
var i;
|
||||||
|
var to_process = [];
|
||||||
|
for (i = 0; i < msgs.length && msgs[i].id <= narrowed_msg_list.selected_id(); ++i) {
|
||||||
|
to_process.push(msgs[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
process_unread_counts(to_process, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (narrowed_msg_list.empty()) {
|
if (narrowed_msg_list.empty()) {
|
||||||
load_old_messages(then_select_id, 200, 200, narrowed_msg_list, function (messages) {
|
load_old_messages(then_select_id, 200, 200, narrowed_msg_list, function (messages) {
|
||||||
maybe_select_closest();
|
maybe_select_closest();
|
||||||
|
mark_loaded_as_unread();
|
||||||
}, true, false);
|
}, true, false);
|
||||||
} else {
|
} else {
|
||||||
maybe_select_closest();
|
maybe_select_closest();
|
||||||
}
|
mark_loaded_as_unread();
|
||||||
|
|
||||||
// Mark as read any messages before or at the pointer in the narrowed view
|
|
||||||
if (! narrowed_msg_list.empty()) {
|
|
||||||
// XXX: We shouldn't really be directly accessing the message list
|
|
||||||
var msgs = narrowed_msg_list.all();
|
|
||||||
var i;
|
|
||||||
var to_process = [];
|
|
||||||
for (i = 0; i < msgs.length && msgs[i].id <= narrowed_msg_list.selected_id(); ++i) {
|
|
||||||
to_process.push(msgs[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
process_unread_counts(to_process, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show the new set of messages.
|
// Show the new set of messages.
|
||||||
|
|
Loading…
Reference in New Issue