message_viewport: Call set_message_offset() for prepending.

This is consistent with other places in the code.
This commit is contained in:
Steve Howell
2018-03-11 14:09:17 -04:00
committed by Tim Abbott
parent 58c1427859
commit 12509515ae

View File

@@ -797,13 +797,13 @@ MessageListView.prototype = {
},
rerender_preserving_scrolltop: function MessageListView__rerender_preserving_scrolltop() {
// scrolltop_offset is the number of pixels between the top of the
// old_offset is the number of pixels between the top of the
// viewable window and the selected message
var scrolltop_offset;
var old_offset;
var selected_row = this.selected_row();
var selected_in_view = (selected_row.length > 0);
if (selected_in_view) {
scrolltop_offset = selected_row.offset().top;
old_offset = selected_row.offset().top;
}
this.clear_table();
@@ -817,10 +817,8 @@ MessageListView.prototype = {
if (this.selected_row().length === 0 && this.list.selected_id() > -1) {
this.list.select_id(this.list.selected_id(), {use_closest: true});
}
// Must get this.list.selected_row() again since it is now a new DOM element
message_viewport.scrollTop(
message_viewport.scrollTop() +
this.selected_row().offset().top - scrolltop_offset);
message_viewport.set_message_offset(old_offset);
}
},