diff options
| author | Sébastien Theys <seb@odoo.com> | 2020-10-23 11:03:09 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2020-10-23 11:03:10 +0000 |
| commit | 91ce61ba568d83190e7ed2c168fd56101474683b (patch) | |
| tree | 474e1da8fefde0a147ccc68c0f5868eeff250a45 /addons/mail/static/src/components/message_list | |
| parent | 50b8e83597ec07e091e1a4b62184e148ddcfb6c5 (diff) | |
[FIX] mail: do not return members of channels in channel_info
This PR has 3 parts:
The members fix itself, which is necessary for performance reasons especially
at init messaging, as per described in the task.
Adding the partner name in the typing payload, because due to not knowing all
members anymore, it is necessary to properly display who is typing.
Restrict restoring scroll position only if the corresponding scroll height is
available, to make the scroll feature and particularly the corresponding tests
more robust.
task-2360020
closes odoo/odoo#60091
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/components/message_list')
| -rw-r--r-- | addons/mail/static/src/components/message_list/message_list.js | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/addons/mail/static/src/components/message_list/message_list.js b/addons/mail/static/src/components/message_list/message_list.js index 708af154cb8..d24e1ccf6fc 100644 --- a/addons/mail/static/src/components/message_list/message_list.js +++ b/addons/mail/static/src/components/message_list/message_list.js @@ -162,6 +162,13 @@ class MessageList extends Component { /** * @returns {integer} */ + getScrollHeight() { + return this.el.scrollHeight; + } + + /** + * @returns {integer} + */ getScrollTop() { return this.el.scrollTop; } @@ -323,9 +330,13 @@ class MessageList extends Component { if (threadCache.messages.length > 0) { if (this.threadView.threadCacheInitialScrollPosition !== undefined) { if (this.props.hasScrollAdjust) { - this.el.scrollTop = this.threadView.threadCacheInitialScrollPosition; + if (this.el.scrollHeight === this.threadView.threadCacheInitialScrollHeight) { + this.el.scrollTop = this.threadView.threadCacheInitialScrollPosition; + isProcessed = true; + } + } else { + isProcessed = true; } - isProcessed = true; } else { const lastMessage = threadCache.lastMessage; if (this.messageRefFromId(lastMessage.id)) { @@ -348,8 +359,9 @@ class MessageList extends Component { * @param {Object} hint */ _adjustFromChatWindowUnfolded(hint) { - this._adjustScrollFromModel(); - this.threadView.markComponentHintProcessed(hint); + if (this._adjustScrollFromModel()) { + this.threadView.markComponentHintProcessed(hint); + } } /** @@ -357,8 +369,9 @@ class MessageList extends Component { * @param {Object} hint */ _adjustFromHomeMenuHidden(hint) { - this._adjustScrollFromModel(); - this.threadView.markComponentHintProcessed(hint); + if (this._adjustScrollFromModel()) { + this.threadView.markComponentHintProcessed(hint); + } } /** @@ -366,8 +379,9 @@ class MessageList extends Component { * @param {Object} hint */ _adjustFromHomeMenuShown(hint) { - this._adjustScrollFromModel(); - this.threadView.markComponentHintProcessed(hint); + if (this._adjustScrollFromModel()) { + this.threadView.markComponentHintProcessed(hint); + } } /** @@ -423,14 +437,21 @@ class MessageList extends Component { /** * @private + * @returns {boolean} whether the adjustment should be considered processed */ _adjustScrollFromModel() { if ( this.threadView.threadCacheInitialScrollPosition !== undefined && this.props.hasScrollAdjust ) { - this.el.scrollTop = this.threadView.threadCacheInitialScrollPosition; + if (this.el.scrollHeight === this.threadView.threadCacheInitialScrollHeight) { + this.el.scrollTop = this.threadView.threadCacheInitialScrollPosition; + return true; + } else { + return false; + } } + return true; } /** @@ -560,6 +581,7 @@ class MessageList extends Component { ? scrollTop >= this.el.scrollHeight - this.el.clientHeight - margin : scrollTop <= margin; this.threadView.update({ hasAutoScrollOnMessageReceived }); + this.threadView.threadViewer.saveThreadCacheScrollHeightAsInitial(this.el.scrollHeight); this.threadView.threadViewer.saveThreadCacheScrollPositionsAsInitial(scrollTop); if (!this._isAutoLoadOnScrollActive) { return; |
