summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/models/threads/document_thread.js
diff options
context:
space:
mode:
authorPratima Gupta <pgu@odoo.com>2018-08-07 16:10:10 +0530
committerAlexandre Kühn <aku@odoo.com>2018-08-09 13:19:00 +0200
commitfca1875a69b4e79bb3faebaf3dc05cd448772b82 (patch)
tree2d441ed6af4c9151b8d0ff1440174c3482ddfe1c /addons/mail/static/src/js/models/threads/document_thread.js
parente0bc158655b03150f6848f4243136aa66311c38e (diff)
[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
Diffstat (limited to 'addons/mail/static/src/js/models/threads/document_thread.js')
-rw-r--r--addons/mail/static/src/js/models/threads/document_thread.js5
1 files changed, 5 insertions, 0 deletions
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) {