mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
message_viewport: Call set_message_offset() for prepending.
This is consistent with other places in the code.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user