diff options
| author | Alexandre Kühn <aku@odoo.com> | 2018-08-23 14:10:03 +0200 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2018-09-20 17:19:02 +0200 |
| commit | 3457e037e9801a700982153746c4ef8ec35f8183 (patch) | |
| tree | fef6e74976c65a9b5a90e2708fe47a3667b9fe9f /addons/mail/static/src/js/models/threads/document_thread.js | |
| parent | 6a862ba0d5b6264af9c70582dc862210d411fb39 (diff) | |
[FIX] mail: mark document thread preview as read
Before this commit, it was not possible to mark a document
thread preview as read from the messaging menu.
This issue comes from the fact that document message previews
are built from messages in the Inbox. The computation of
the unread counter is correct for the preview, but not for
the associated document thread object which has a counter of 0.
Since it is only possible to mark as read when the counter is
strictly greater than 0, the 'mark as read' did not have any
impact.
This commit fixes this issue by ensuring that the unread counter
of a document thread matches the number of needaction messages it
contains.
Task-ID 1875668
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.js | 8 |
1 files changed, 8 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 283bcf3ca66..f90da991960 100644 --- a/addons/mail/static/src/js/models/threads/document_thread.js +++ b/addons/mail/static/src/js/models/threads/document_thread.js @@ -188,6 +188,10 @@ var DocumentThread = Thread.extend({ * Add this message to this document thread. * * This is ignored if the message is already linked to this document thread. + * Also, there is no fetch of unread message counter in a document thread, + * as this object is built from messages and/or thread field widget. The + * unread counter of a document thread is the sum of needaction messages + * linked to this document thread. * * @override * @private @@ -207,6 +211,10 @@ var DocumentThread = Thread.extend({ if (!_.contains(this._messageIDs, message.getID())) { this._messageIDs.push(message.getID()); } + // update unread counter + if (message.isNeedaction()) { + this._unreadCounter++; + } }, /** * Get most up to date messageIDs |
