summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/thread_field.js
diff options
context:
space:
mode:
authorAlexandre Kühn <aku@odoo.com>2018-10-24 12:58:47 +0000
committerAlexandre Kühn <aku@odoo.com>2018-10-26 08:39:39 +0000
commit17bb0ca443f54bc231b03794e776bbc6992ffdfa (patch)
tree1db1a2aad7f97993e6f32aa81dcba963662e85a6 /addons/mail/static/src/js/thread_field.js
parentb650dc7a21fbc2ac2a2d8040682af846f6120370 (diff)
[FIX] mail: mark as read only when accessing to chatter
Before this commit, the user could not receive any notification from the chatter of a document when having Notification Management set to "Handle with Odoo". This problem occurs when the user opens (or has opened) the document. Any messages received from the document are automatically marked as read, so it removes the notification right after receiving it. In order to no longer have this issue, the user had to reload all pages that have opened this document. This commit slightly changes the behaviour of the chatter, so that it automatically marks it as read only when accessing the document, but not when the document is open (or has been opened). Consequently, if the user has opened the document and then receives a notification from this document, it won't automatically mark it as read. Task-ID 1895359 opw-1890556 closes odoo/odoo#28114
Diffstat (limited to 'addons/mail/static/src/js/thread_field.js')
-rw-r--r--addons/mail/static/src/js/thread_field.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/addons/mail/static/src/js/thread_field.js b/addons/mail/static/src/js/thread_field.js
index 5484fb1aa61..5c85a2adb37 100644
--- a/addons/mail/static/src/js/thread_field.js
+++ b/addons/mail/static/src/js/thread_field.js
@@ -20,6 +20,9 @@ var ThreadField = AbstractField.extend({
*/
init: function () {
this._super.apply(this, arguments);
+ // Used to automatically mark document thread as read at the moment we
+ // access the document and render the thread.
+ this._markAsReadOnNextRender = false;
this._setDocumentThread();
},
/**
@@ -115,7 +118,10 @@ var ThreadField = AbstractField.extend({
self._threadWidget.render(self._documentThread, {
displayLoadMore: self._documentThread.getMessages().length < self._documentThread.getMessageIDs().length,
});
- return self._documentThread.markAsRead();
+ if (self._markAsReadOnNextRender) {
+ self._markAsReadOnNextRender = false;
+ return self._documentThread.markAsRead();
+ }
});
}
},
@@ -157,6 +163,7 @@ var ThreadField = AbstractField.extend({
this._documentThread = null;
} else {
this._documentThread = this.call('mail_service', 'getOrAddDocumentThread', params);
+ this._markAsReadOnNextRender = true;
}
},