mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 20:41:46 +00:00
Fix traceback when unnarrowing before home message list has loaded.
If we load a browser window in a narrowed view and then un-narrow before the home message list has loaded, we end up attempting to select message ID -1 from home_msg_list even though it is empty, triggering a traceback. (imported from commit eb8b686f6e9c1fa518028e5755ac6196781e92d7)
This commit is contained in:
@@ -378,6 +378,7 @@ exports.deactivate = function () {
|
|||||||
message_tour.finish_tour();
|
message_tour.finish_tour();
|
||||||
|
|
||||||
current_msg_list = home_msg_list;
|
current_msg_list = home_msg_list;
|
||||||
|
if (current_msg_list.selected_id() !== -1) {
|
||||||
var preserve_pre_narrowing_screen_position =
|
var preserve_pre_narrowing_screen_position =
|
||||||
(current_msg_list.selected_row().length > 0) &&
|
(current_msg_list.selected_row().length > 0) &&
|
||||||
(current_msg_list.pre_narrow_offset !== undefined);
|
(current_msg_list.pre_narrow_offset !== undefined);
|
||||||
@@ -402,6 +403,7 @@ exports.deactivate = function () {
|
|||||||
// TODO: Make this correctly handle the case of resizing while narrowed.
|
// TODO: Make this correctly handle the case of resizing while narrowed.
|
||||||
viewport.scrollTop(current_msg_list.selected_row().offset().top - current_msg_list.pre_narrow_offset);
|
viewport.scrollTop(current_msg_list.selected_row().offset().top - current_msg_list.pre_narrow_offset);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
hashchange.save_narrow();
|
hashchange.save_narrow();
|
||||||
compose_fade.update_message_list();
|
compose_fade.update_message_list();
|
||||||
|
|||||||
Reference in New Issue
Block a user