[IMP] mail: display subject in chatter

PURPOSE

Currently subject of message is visible in Discuss' Inbox and mailing channels,
need to add subject into chatter and non mailing channels.

SPECIFICATION

Adding subject into the message in chatter and non mailing channels.

LINKS

PR https://github.com/odoo/odoo/pull/61570
Task-2156170

closes odoo/odoo#61570

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
Ipsita Borisagar
2021-03-23 10:11:37 +00:00
parent 7a235c19ff
commit 5c4133f074
4 changed files with 98 additions and 4 deletions
@@ -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);
@@ -79,7 +79,6 @@ class Message extends Component {
partnerRoot,
thread,
threadHasSeenIndicators: thread && thread.hasSeenIndicators,
threadMassMailing: thread && thread.mass_mailing,
};
}, {
compareDepth: {
@@ -180,7 +180,7 @@
</ul>
</t>
</div>
<t t-if="message.subject and !message.isSubjectSimilarToOriginThreadName and threadView and threadView.thread and (threadView.thread.mass_mailing or [env.messaging.inbox, env.messaging.history].includes(threadView.thread))">
<t t-if="message.subject and !message.isSubjectSimilarToOriginThreadName">
<p class="o_Message_subject">Subject: <t t-esc="message.subject"/></p>
</t>
<t t-if="message.attachments and message.attachments.length > 0">
@@ -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);