Don't mark messages read when the pointer lands on them when narrowing.

This is slightly inconsistent, but keeps the unread count from decreasing
when narrowing and un-narrowing.

(imported from commit 185e8653c31a312c166e784b335ae7ae7e9b78e9)
This commit is contained in:
Kevin Mehall 2013-07-03 13:15:07 -04:00
parent 0f6bdafea3
commit 56bd11fa7f
3 changed files with 5 additions and 4 deletions

View File

@ -104,9 +104,10 @@ MessageList.prototype = {
},
select_id: function MessageList_select_id(id, opts) {
opts = $.extend({then_scroll: false, use_closest: false}, opts, {id: id,
opts = $.extend({then_scroll: false, use_closest: false, mark_read: true}, opts, {id: id,
msg_list: this,
previously_selected: this._selected_id});
id = parseInt(id, 10);
if (isNaN(id)) {
blueslip.fatal("Bad message id");

View File

@ -410,7 +410,7 @@ exports.activate = function (operators, opts) {
}
});
}
narrowed_msg_list.select_id(then_select_id, {then_scroll: true, use_closest: true});
narrowed_msg_list.select_id(then_select_id, {then_scroll: true, use_closest: true, mark_read: false});
}
}
@ -532,7 +532,7 @@ exports.deactivate = function () {
current_msg_list = home_msg_list;
// We fall back to the closest selected id, if the user has removed a stream from the home
// view since leaving it the old selected id might no longer be there
home_msg_list.select_id(home_msg_list.selected_id(), {then_scroll: true, use_closest: true});
home_msg_list.select_id(home_msg_list.selected_id(), {then_scroll: true, use_closest: true, mark_read: false});
hashchange.save_narrow();

View File

@ -419,7 +419,7 @@ $(function () {
respond_to_cursor = false;
}
if (event.previously_selected !== -1) {
if (event.mark_read && event.previously_selected !== -1) {
// Mark messages between old pointer and new pointer as read
if (event.id < event.previously_selected) {
mark_read_between(event.msg_list, event.id, event.previously_selected);