From fca1875a69b4e79bb3faebaf3dc05cd448772b82 Mon Sep 17 00:00:00 2001 From: Pratima Gupta Date: Tue, 7 Aug 2018 16:10:10 +0530 Subject: [FIX] mail: no duplicated messages on (un)star document thread message Before this commit, when we star or unstar a message from a document thread, the message was duplicated in the document thread. This commit fixes this issue by not adding already existing messages on document threads. Task-ID 1871428 --- addons/mail/static/src/js/models/threads/document_thread.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'addons/mail/static/src/js/models/threads') 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 88203b3e8d8..831c46939a8 100644 --- a/addons/mail/static/src/js/models/threads/document_thread.js +++ b/addons/mail/static/src/js/models/threads/document_thread.js @@ -60,10 +60,15 @@ var DocumentThread = Thread.extend({ /** * Add this message to this document thread. * + * This is ignored if the message is already linked to this document thread. + * * @override * @param {mail.model.Message} message */ addMessage: function (message) { + if (_.contains(this._messages, message)) { + return; + } // update internal list of messages this._messages.push(message); this._messages = _.sortBy(this._messages, function (msg) { -- cgit v1.2.3