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,14 +241,7 @@ exports.activate = function (operators, opts) {
add_messages(all_msg_list.all(), narrowed_msg_list); add_messages(all_msg_list.all(), narrowed_msg_list);
} }
if (narrowed_msg_list.empty()) { function mark_loaded_as_unread() {
load_old_messages(then_select_id, 200, 200, narrowed_msg_list, function (messages) {
maybe_select_closest();
}, true, false);
} else {
maybe_select_closest();
}
// Mark as read any messages before or at the pointer in the narrowed view // Mark as read any messages before or at the pointer in the narrowed view
if (! narrowed_msg_list.empty()) { if (! narrowed_msg_list.empty()) {
// XXX: We shouldn't really be directly accessing the message list // XXX: We shouldn't really be directly accessing the message list
@ -261,6 +254,17 @@ exports.activate = function (operators, opts) {
process_unread_counts(to_process, true); 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_loaded_as_unread();
}
// Show the new set of messages. // Show the new set of messages.
$("#main_div").addClass("narrowed_view"); $("#main_div").addClass("narrowed_view");