[IMP] mail: no jump for chatter show older messages
When clicking on "Show older messages" in the bottom of the chatter, the page would jump to the top when the additional messages are loaded. There is already a functionality in a discuss channel to stay at the previous scrolling position (related to the content) : https://github.com/odoo/odoo/blob/ffe0db0d/addons/mail/static/src/js/client_action.js#L506-L521 This fix does the same steps for the chatter. opw-692010
This commit is contained in:
@@ -11,6 +11,7 @@ var core = require('web.core');
|
||||
var data = require('web.data');
|
||||
var Dialog = require('web.Dialog');
|
||||
var form_common = require('web.form_common');
|
||||
var framework = require('web.framework');
|
||||
var session = require('web.session');
|
||||
|
||||
var _t = core._t;
|
||||
@@ -841,7 +842,14 @@ var Chatter = form_common.AbstractField.extend({
|
||||
},
|
||||
|
||||
load_more_messages: function () {
|
||||
this.fetch_and_render_thread(this.msg_ids, {force_fetch: true});
|
||||
var self = this;
|
||||
var top_msg_id = this.$('.o_thread_message').first().data('messageId');
|
||||
var top_msg_selector = '.o_thread_message[data-message-id="' + top_msg_id + '"]';
|
||||
var offset = -framework.getPosition(document.querySelector(top_msg_selector)).top;
|
||||
this.fetch_and_render_thread(this.msg_ids, {force_fetch: true}).then(function(){
|
||||
offset += framework.getPosition(document.querySelector(top_msg_selector)).top;
|
||||
self.thread.scroll_to({offset: offset});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user