Avoid brittle attempt to get messages with id === -1.

Even when then_select_id has the sentinel value of -1, we were
trying to look it up in our message_list.all object.  This would
have returned undefined, which is fine, but it's more explicit
to just bypass the check.
This commit is contained in:
Steve Howell 2018-05-03 11:21:52 +00:00 committed by Tim Abbott
parent 6bab68ff6a
commit d021a51047
1 changed files with 7 additions and 3 deletions

View File

@ -187,9 +187,13 @@ exports.activate = function (raw_operators, opts) {
// Populate the message list if we can apply our filter locally (i.e.
// with no backend help) and we have the message we want to select.
if (narrow_state.get_current_filter().can_apply_locally()) {
if (message_list.all.get(then_select_id) !== undefined) {
message_util.add_messages(message_list.all.all_messages(), message_list.narrowed,
{delay_render: true});
if (then_select_id !== -1) {
if (message_list.all.get(then_select_id) !== undefined) {
message_util.add_messages(
message_list.all.all_messages(),
message_list.narrowed,
{delay_render: true});
}
}
}