Fix narrowing not marking as unread when backfilling messages

(imported from commit 91b164251b0c2f97bf70c0051216347e2a4616eb)
This commit is contained in:
Leo Franchi 2013-02-22 10:46:04 -05:00
parent 9fb5487473
commit ca0f414b60
1 changed files with 17 additions and 13 deletions

View File

@ -241,25 +241,29 @@ exports.activate = function (operators, opts) {
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()) {
load_old_messages(then_select_id, 200, 200, narrowed_msg_list, function (messages) {
maybe_select_closest();
mark_loaded_as_unread();
}, true, false);
} else {
maybe_select_closest();
}
// 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);
mark_loaded_as_unread();
}
// Show the new set of messages.