summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/models/threads
diff options
context:
space:
mode:
authorAlexandre Kühn <aku@odoo.com>2019-07-16 10:32:33 +0000
committerAlexandre Kühn <aku@odoo.com>2019-07-16 14:36:44 +0000
commita203e5318efd1175d040f54105b68ad1df0222d1 (patch)
treeb57249408609a46ab574a77befcb0556d148712e /addons/mail/static/src/js/models/threads
parentbdf45dca506f9938bfcd3a7acc8757a16d701d05 (diff)
[FIX] mail: re-render discuss on message_fetch with typing members
When (un)registering a typing members of a channel, the discuss sidebar must be re-render. This is necessary in order to display the typing indicator next to discuss items, i.e. '...'. When receiving a message from a typing member, this person no longer becomes a typing member. Before this commit, for each new messages, the discuss sidebar was re-rendered. This happens due to unregistering the author from the typing members of the channel, even when the author was not a typing member in the first place. With this commit, when the list of typing members of a channel does not change, the discuss sidebar won't re-render and slow down the whole UI. opw-2035443 closes odoo/odoo#33616 Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>
Diffstat (limited to 'addons/mail/static/src/js/models/threads')
-rw-r--r--addons/mail/static/src/js/models/threads/mixins/thread_typing_mixin.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/addons/mail/static/src/js/models/threads/mixins/thread_typing_mixin.js b/addons/mail/static/src/js/models/threads/mixins/thread_typing_mixin.js
index f995b4e09b3..d000bc4a7c5 100644
--- a/addons/mail/static/src/js/models/threads/mixins/thread_typing_mixin.js
+++ b/addons/mail/static/src/js/models/threads/mixins/thread_typing_mixin.js
@@ -171,11 +171,15 @@ var ThreadTypingMixin = {
if (this._isTypingMyselfInfo(params)) {
return;
}
+ var partnerID = params.partnerID;
this._othersTypingTimers.registerTimer({
- timeoutCallbackArguments: [params.partnerID],
- timerID: params.partnerID,
+ timeoutCallbackArguments: [partnerID],
+ timerID: partnerID,
});
- this._typingPartnerIDs.push(params.partnerID);
+ if (_.contains(this._typingPartnerIDs, partnerID)) {
+ return;
+ }
+ this._typingPartnerIDs.push(partnerID);
this._warnUpdatedTypingPartners();
},
/**
@@ -209,6 +213,9 @@ var ThreadTypingMixin = {
unregisterTyping: function (params) {
var partnerID = params.partnerID;
this._othersTypingTimers.unregisterTimer({ timerID: partnerID });
+ if (!_.contains(this._typingPartnerIDs, partnerID)) {
+ return;
+ }
this._typingPartnerIDs = _.reject(this._typingPartnerIDs, function (id) {
return id === partnerID;
});