diff --git a/addons/mail/static/src/components/chatter/chatter_tests.js b/addons/mail/static/src/components/chatter/chatter_tests.js index 15163e85709..c5800f685a1 100644 --- a/addons/mail/static/src/components/chatter/chatter_tests.js +++ b/addons/mail/static/src/components/chatter/chatter_tests.js @@ -334,6 +334,69 @@ QUnit.test('composer show/hide on log note/send message [REQUIRE FOCUS]', async ); }); +QUnit.test('should display subject when subject is not the same as the thread name', async function (assert) { + assert.expect(2); + + this.data['res.partner'].records.push({ id: 100 }); + this.data['mail.message'].records.push({ + body: "not empty", + model: 'res.partner', + res_id: 100, + subject: "Salutations, voyageur", + }); + await this.start(); + const thread = this.env.models['mail.thread'].create({ + id: 100, + model: 'res.partner', + name: "voyageur", + }); + const chatter = this.env.models['mail.chatter'].create({ + threadId: 100, + threadModel: 'res.partner', + }); + await this.createChatterComponent({ chatter }); + + assert.containsOnce( + document.body, + '.o_Message_subject', + "should display subject of the message" + ); + assert.strictEqual( + document.querySelector('.o_Message_subject').textContent, + "Subject: Salutations, voyageur", + "Subject of the message should be 'Salutations, voyageur'" + ); +}); + +QUnit.test('should not display subject when subject is the same as the thread name', async function (assert) { + assert.expect(1); + + this.data['res.partner'].records.push({ id: 100 }); + this.data['mail.message'].records.push({ + body: "not empty", + model: 'res.partner', + res_id: 100, + subject: "Salutations, voyageur", + }); + await this.start(); + const thread = this.env.models['mail.thread'].create({ + id: 100, + model: 'res.partner', + name: "Salutations, voyageur", + }); + const chatter = this.env.models['mail.chatter'].create({ + threadId: 100, + threadModel: 'res.partner', + }); + await this.createChatterComponent({ chatter }); + + assert.containsNone( + document.body, + '.o_Message_subject', + "should not display subject of the message" + ); +}); + QUnit.test('should not display user notification messages in chatter', async function (assert) { assert.expect(1); diff --git a/addons/mail/static/src/components/message/message.js b/addons/mail/static/src/components/message/message.js index 3f5314eef13..a954b697a69 100644 --- a/addons/mail/static/src/components/message/message.js +++ b/addons/mail/static/src/components/message/message.js @@ -79,7 +79,6 @@ class Message extends Component { partnerRoot, thread, threadHasSeenIndicators: thread && thread.hasSeenIndicators, - threadMassMailing: thread && thread.mass_mailing, }; }, { compareDepth: { diff --git a/addons/mail/static/src/components/message/message.xml b/addons/mail/static/src/components/message/message.xml index f67fb41673f..ba16591aee3 100644 --- a/addons/mail/static/src/components/message/message.xml +++ b/addons/mail/static/src/components/message/message.xml @@ -180,7 +180,7 @@ - +

Subject:

diff --git a/addons/mail/static/src/components/thread_view/thread_view_tests.js b/addons/mail/static/src/components/thread_view/thread_view_tests.js index 9fadeea475f..8b3e08cbf15 100644 --- a/addons/mail/static/src/components/thread_view/thread_view_tests.js +++ b/addons/mail/static/src/components/thread_view/thread_view_tests.js @@ -453,13 +453,12 @@ QUnit.test('mark channel as fetched and seen when a new message is loaded if com ); }); -QUnit.test('show message subject if thread is mailing channel', async function (assert) { +QUnit.test('show message subject when subject is not the same as the thread name', async function (assert) { assert.expect(3); this.data['mail.channel'].records.push({ channel_type: 'channel', id: 100, - mass_mailing: true, name: "General", public: 'public', }); @@ -497,6 +496,39 @@ QUnit.test('show message subject if thread is mailing channel', async function ( ); }); +QUnit.test('do not show message subject when subject is the same as the thread name', async function (assert) { + assert.expect(1); + + this.data['mail.channel'].records.push({ + channel_type: 'channel', + id: 100, + name: "Salutations, voyageur", + public: 'public', + }); + this.data['mail.message'].records.push({ + body: "not empty", + model: 'mail.channel', + res_id: 100, + subject: "Salutations, voyageur", + }); + await this.start(); + const thread = this.env.models['mail.thread'].findFromIdentifyingData({ + id: 100, + model: 'mail.channel', + }); + const threadViewer = this.env.models['mail.thread_viewer'].create({ + hasThreadView: true, + thread: [['link', thread]], + }); + await this.createThreadViewComponent(threadViewer.threadView); + + assert.containsNone( + document.body, + '.o_Message_subject', + "should not display subject of the message" + ); +}); + QUnit.test('[technical] new messages separator on posting message', async function (assert) { // technical as we need to remove focus from text input to avoid `channel_seen` call assert.expect(4);