[FIX] mail: show subject of the message in inbox if set
task-2280146 closes odoo/odoo#54599 X-original-commit: 3114c7dab3c7f0f63e59f01fd06237fdc109203a Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
@@ -411,6 +411,99 @@ QUnit.test('"reply to" composer should send message if message replied to is not
|
||||
assert.verifySteps(['message_post']);
|
||||
});
|
||||
|
||||
QUnit.test('show subject of message in inbox', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
this.data['mail.message'].records = [{
|
||||
author_id: [7, "Demo"],
|
||||
body: "<p>Test</p>",
|
||||
date: "2019-04-20 11:00:00",
|
||||
id: 100,
|
||||
is_discussion: false,
|
||||
is_notification: false,
|
||||
message_type: 'comment',
|
||||
needaction: true,
|
||||
needaction_partner_ids: [3],
|
||||
model: 'mail.channel',
|
||||
res_id: 20,
|
||||
subject: "Salutations, voyageur",
|
||||
}];
|
||||
|
||||
await this.start({
|
||||
env: {
|
||||
session: {
|
||||
name: 'Admin',
|
||||
partner_display_name: 'Your Company, Admin',
|
||||
partner_id: 3,
|
||||
uid: 2,
|
||||
},
|
||||
},
|
||||
});
|
||||
assert.containsOnce(
|
||||
document.body,
|
||||
'.o_Message',
|
||||
"should display a single message"
|
||||
);
|
||||
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('show subject of message in history', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
this.data['mail.message'].records = [{
|
||||
author_id: [7, "Demo"],
|
||||
body: "<p>Test</p>",
|
||||
date: "2019-04-20 11:00:00",
|
||||
history_partner_ids: [3],
|
||||
id: 100,
|
||||
message_type: 'comment',
|
||||
model: 'project.task',
|
||||
record_name: "Refactoring",
|
||||
res_id: 20,
|
||||
subject: "Salutations, voyageur",
|
||||
}];
|
||||
|
||||
await this.start({
|
||||
discuss: {
|
||||
params: {
|
||||
default_active_id: 'mail.box_history',
|
||||
},
|
||||
},
|
||||
env: {
|
||||
session: {
|
||||
name: 'Admin',
|
||||
partner_display_name: 'Your Company, Admin',
|
||||
partner_id: 3,
|
||||
uid: 2,
|
||||
},
|
||||
},
|
||||
});
|
||||
assert.containsOnce(
|
||||
document.body,
|
||||
'.o_Message',
|
||||
"should display a single message"
|
||||
);
|
||||
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'"
|
||||
)
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -180,6 +180,9 @@
|
||||
</ul>
|
||||
</t>
|
||||
</div>
|
||||
<t t-if="message.subject and threadViewer and threadViewer.thread and (threadViewer.thread.mass_mailing or [env.messaging.inbox, env.messaging.history].includes(threadViewer.thread))">
|
||||
<p class="o_Message_subject">Subject: <t t-esc="message.subject"/></p>
|
||||
</t>
|
||||
<t t-if="message.attachments and message.attachments.length > 0">
|
||||
<div class="o_Message_footer">
|
||||
<!-- TODO XDU This does not allow to preview all attachments at once, find somethind else -->
|
||||
|
||||
@@ -430,6 +430,52 @@ QUnit.test('mark channel as fetched and seen when a new message is loaded if com
|
||||
"Channel should have been mark as seen directly"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test('show message subject if thread is mailing channel', async function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
this.data['mail.message'].records = [{
|
||||
author_id: [7, "Demo"],
|
||||
body: "<p>Test</p>",
|
||||
channel_ids: [100],
|
||||
date: "2019-04-20 11:00:00",
|
||||
id: 100,
|
||||
is_discussion: false,
|
||||
is_notification: false,
|
||||
message_type: 'comment',
|
||||
model: 'mail.channel',
|
||||
res_id: 20,
|
||||
subject: "Salutations, voyageur",
|
||||
}];
|
||||
await this.start();
|
||||
const thread = this.env.models['mail.thread'].create({
|
||||
channel_type: 'channel',
|
||||
id: 100,
|
||||
mass_mailing: true,
|
||||
model: 'mail.channel',
|
||||
name: "General",
|
||||
public: 'public',
|
||||
});
|
||||
const threadViewer = this.env.models['mail.thread_viewer'].create({ thread: [['link', thread]] });
|
||||
await this.createThreadViewerComponent(threadViewer);
|
||||
|
||||
assert.containsOnce(
|
||||
document.body,
|
||||
'.o_Message',
|
||||
"should display a single message"
|
||||
);
|
||||
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'"
|
||||
)
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user