summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/models/thread_view/thread_view.js
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2021-01-20 17:12:01 +0000
committerSébastien Theys <seb@odoo.com>2021-01-20 17:12:01 +0000
commit0e9fb00f7863593fa63a3adf2593fb48dfb168b1 (patch)
tree72e3add4dea96c5c7ee11eca0a44a237a32bf563 /addons/mail/static/src/models/thread_view/thread_view.js
parent6532c6ba7acb2de53fc839d5a7c5d8b200716565 (diff)
[FIX] mail: more consistent async handling of scroll feature
task-2333535 task-2388676 closes odoo/odoo#64505 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/thread_view/thread_view.js')
-rw-r--r--addons/mail/static/src/models/thread_view/thread_view.js17
1 files changed, 6 insertions, 11 deletions
diff --git a/addons/mail/static/src/models/thread_view/thread_view.js b/addons/mail/static/src/models/thread_view/thread_view.js
index 5c65e19c0f8..bf4560998bd 100644
--- a/addons/mail/static/src/models/thread_view/thread_view.js
+++ b/addons/mail/static/src/models/thread_view/thread_view.js
@@ -45,17 +45,8 @@ function factory(dependencies) {
* @param {Object} hint
*/
markComponentHintProcessed(hint) {
- let filterFun;
- switch (hint.type) {
- case 'message-received':
- filterFun = h => h.type !== hint.type && h.message !== hint.data.message;
- break;
- default:
- filterFun = h => h.type !== hint.type;
- break;
- }
this.update({
- componentHintList: this.componentHintList.filter(filterFun),
+ componentHintList: this.componentHintList.filter(h => h !== hint),
});
this.env.messagingBus.trigger('o-thread-view-hint-processed', {
hint,
@@ -143,6 +134,8 @@ function factory(dependencies) {
* @private
*/
_onThreadCacheChanged() {
+ // clear obsolete hints
+ this.update({ componentHintList: clear() });
this.addComponentHint('change-of-thread-cache');
if (this.threadCache) {
this.threadCache.update({ isCacheRefreshRequested: true });
@@ -236,7 +229,9 @@ function factory(dependencies) {
* a new message. Detection of new message is done through the component
* hint `message-received`.
*/
- hasAutoScrollOnMessageReceived: attr(),
+ hasAutoScrollOnMessageReceived: attr({
+ default: true,
+ }),
/**
* Last message in the context of the currently displayed thread cache.
*/