Fix the selected message when narrowing to a stream that has no messages loaded

We would previously scroll you to the top of the just-loaded block of
messages

(imported from commit 520e5588aa078313649677663c7feea4ca1d7145)
This commit is contained in:
Zev Benjamin
2013-02-20 16:59:56 -05:00
parent 4c9e3a167e
commit 48e7fed00f
3 changed files with 22 additions and 13 deletions

View File

@@ -39,7 +39,13 @@ function parse_narrow(hash) {
var operand = decodeURIComponent(hash[i+1] || '');
operators.push([operator, operand]);
}
narrow.activate(operators, {target_id: initial_pointer});
var new_selection;
if (current_msg_list.selected_id() !== -1) {
new_selection = current_msg_list.selected_id();
} else {
new_selection = initial_pointer;
}
narrow.activate(operators, {then_select_id: new_selection});
}
// Returns true if this function performed a narrow