From 9269e876fd62e51360d695342f0634dffdf6f87d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Thu, 23 May 2019 11:00:53 +0000 Subject: [FIX] mail: notify other tabs on document thread message post MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, most new messages added to the mail manager were handled as if recently posted from a document thread. As a result, it was frequently setting a new item in the local storage to notify other tabs from these new messages. The intent of this behaviour is to notify other tabs of newly posted messages in a document thread, without using a longpolling notification. That means this logic should only apply on messages that have been recently posted on a document thread. Sometimes, this issue was breaking the local storage on Firefox. It showed the error message "Quota Exceeded Error" whenever `setItem` was used, even when items were removed beforehand. The capacity of the storage was only a few Kbs on this domain, far from reaching the maximum capacity. We think that this error comes from the concurrent `setItem` on multiple tabs, but this is very hard to reproduce. This commit fixes the issue by limiting the `setItem` to the tab that really posted the message. Tests have been adapted in order to pass only with this fix. note: backport of 12.2 4bde721f9 opw-2031960 closes #35588 Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/js/models/threads/document_thread.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'addons/mail/static/src/js/models/threads/document_thread.js') diff --git a/addons/mail/static/src/js/models/threads/document_thread.js b/addons/mail/static/src/js/models/threads/document_thread.js index dd9a31ceb8c..89ce1f126db 100644 --- a/addons/mail/static/src/js/models/threads/document_thread.js +++ b/addons/mail/static/src/js/models/threads/document_thread.js @@ -340,7 +340,9 @@ var DocumentThread = Thread.extend({ .then(function (messages) { messages[0].model = resModel; messages[0].res_id = resID; - self.call('mail_service', 'addMessage', messages[0]); + self.call('mail_service', 'addMessage', messages[0], { + postedFromDocumentThread: true, + }); return messages[0]; }); }); -- cgit v1.2.3 From 964efa30262870053c298aceb9a0d0eea2b9c473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Tue, 6 Aug 2019 12:37:38 +0000 Subject: [FIX] mail: keep notification on receiving new messages from document Revision on https://github.com/odoo/odoo/commit/17bb0ca443f54bc231b03794e776bbc6992ffdfa closes odoo/odoo#35497 Signed-off-by: Martin Geubelle (mge) --- addons/mail/static/src/js/models/threads/document_thread.js | 1 - 1 file changed, 1 deletion(-) (limited to 'addons/mail/static/src/js/models/threads/document_thread.js') diff --git a/addons/mail/static/src/js/models/threads/document_thread.js b/addons/mail/static/src/js/models/threads/document_thread.js index 89ce1f126db..18f1e4fb762 100644 --- a/addons/mail/static/src/js/models/threads/document_thread.js +++ b/addons/mail/static/src/js/models/threads/document_thread.js @@ -97,7 +97,6 @@ var DocumentThread = Thread.extend({ fetchMessages: function (options) { var self = this; return this._fetchMessages(options).then(function () { - self.call('mail_service', 'markMessagesAsRead', self._messageIDs); return self._messages; }); }, -- cgit v1.2.3