diff --git a/addons/mail/static/src/components/chatter/chatter_tests.js b/addons/mail/static/src/components/chatter/chatter_tests.js index 2043b5eece2..36b87b65f5d 100644 --- a/addons/mail/static/src/components/chatter/chatter_tests.js +++ b/addons/mail/static/src/components/chatter/chatter_tests.js @@ -340,6 +340,32 @@ QUnit.test('composer show/hide on log note/send message', async function (assert ); }); +QUnit.test('should not display user notification messages in chatter', async function (assert) { + assert.expect(1); + + this.data['mail.message'].records = [{ + author_id: [7, "Demo"], + body: "

User notification

", + date: "2019-04-20 11:00:00", + id: 102, + message_type: 'user_notification', + model: 'res.partner', + res_id: 100, + }]; + await this.start(); + const chatter = this.env.models['mail.chatter'].create({ + threadId: 100, + threadModel: 'res.partner', + }); + await this.createChatterComponent({ chatter }); + + assert.containsNone( + document.body, + '.o_Message', + "should display no messages" + ); +}); + }); }); }); 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 4fdcaed6114..81027d665ba 100644 --- a/addons/mail/static/src/models/thread_cache/thread_cache.js +++ b/addons/mail/static/src/models/thread_cache/thread_cache.js @@ -234,7 +234,13 @@ function factory(dependencies) { } else if (thread === this.env.messaging.moderation) { return domain.concat([['need_moderation', '=', true]]); } else { - return domain.concat([['model', '=', thread.model], ['res_id', '=', thread.id]]); + // Avoid to load user_notification as these messages are not + // meant to be shown on chatters. + return domain.concat([ + ['message_type', '!=', 'user_notification'], + ['model', '=', thread.model], + ['res_id', '=', thread.id], + ]); } }