summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/models/thread_cache
diff options
context:
space:
mode:
authorXavier Dubuc <xdu@odoo.com>2020-10-15 13:16:02 +0000
committerXavier Dubuc <xdu@odoo.com>2020-10-28 08:05:31 +0000
commit65ffb692164d5370411059dca63223c08c8dc81f (patch)
tree60d4407c43204f515ccca6d45f5520814de86e12 /addons/mail/static/src/models/thread_cache
parentb261ab598c7a18bbe6590114aa171d61ea9c2767 (diff)
[FIX] mail: do not consider message with subtype as empty
task-2362022 closes odoo/odoo#60088 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/thread_cache')
-rw-r--r--addons/mail/static/src/models/thread_cache/thread_cache.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/addons/mail/static/src/models/thread_cache/thread_cache.js b/addons/mail/static/src/models/thread_cache/thread_cache.js
index 4e2bb5208e2..c474c565219 100644
--- a/addons/mail/static/src/models/thread_cache/thread_cache.js
+++ b/addons/mail/static/src/models/thread_cache/thread_cache.js
@@ -160,6 +160,15 @@ function factory(dependencies) {
}
/**
+ *
+ * @private
+ * @returns {mail.message[]}
+ */
+ _computeNonEmptyMessages() {
+ return [['replace', this.messages.filter(message => !message.isEmpty)]]
+ }
+
+ /**
* @private
* @returns {mail.message[]}
*/
@@ -427,6 +436,23 @@ function factory(dependencies) {
],
}),
/**
+ * IsEmpty trait of all messages.
+ * Serves as compute dependency.
+ */
+ messagesAreEmpty: attr({
+ related: 'messages.isEmpty'
+ }),
+ /**
+ * List of non empty messages linked to this cache.
+ */
+ nonEmptyMessages: many2many('mail.message', {
+ compute: '_computeNonEmptyMessages',
+ dependencies: [
+ 'messages',
+ 'messagesAreEmpty',
+ ],
+ }),
+ /**
* Loads initial messages from `this`.
* This is not a "real" field, its compute function is used to trigger
* the load of messages at the right time.