[FIX] mail: new needaction message from chatter in messaging menu
Before this commit, when receiving a new needaction message from chatter, the messaging was not updating itself to show this new needaction. closes odoo/odoo#119843 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
@@ -276,6 +276,11 @@ export class Messaging {
|
||||
inbox.messages.push(message);
|
||||
inbox.counter++;
|
||||
}
|
||||
const thread = message.originThread;
|
||||
if (!thread.needactionMessages.includes(message)) {
|
||||
thread.needactionMessages.push(message);
|
||||
thread.message_needaction_counter++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "mail.message/delete": {
|
||||
|
||||
@@ -13,7 +13,7 @@ export class NotificationItem extends Component {
|
||||
"datetime?",
|
||||
"displayName",
|
||||
"hasMarkAsReadButton?",
|
||||
"iconSrc",
|
||||
"iconSrc?",
|
||||
"isLast",
|
||||
"onClick",
|
||||
"onSwipeLeft?",
|
||||
|
||||
@@ -944,3 +944,24 @@ QUnit.test("failure notifications are shown before channel preview", async (asse
|
||||
".o-mail-NotificationItem:contains(An error occurred when sending an email) ~ .o-mail-NotificationItem:contains(message)"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("messaging menu should show new needaction messages from chatter", async (assert) => {
|
||||
const pyEnv = await startServer();
|
||||
const partnerId = pyEnv["res.partner"].create({ name: "Frodo Baggins" });
|
||||
await start();
|
||||
await click(".o_menu_systray i[aria-label='Messages']");
|
||||
assert.containsNone($, ".o-mail-NotificationItem:contains(@Mitchell Admin)");
|
||||
|
||||
// simulate receiving a new needaction message
|
||||
await afterNextRender(() => {
|
||||
pyEnv["bus.bus"]._sendone(pyEnv.currentPartner, "mail.message/inbox", {
|
||||
body: "@Mitchell Admin",
|
||||
id: 100,
|
||||
needaction_partner_ids: [pyEnv.currentPartnerId],
|
||||
model: "res.partner",
|
||||
res_id: partnerId,
|
||||
record_name: "Frodo Baggins",
|
||||
});
|
||||
});
|
||||
assert.containsOnce($, ".o-mail-NotificationItem:contains(@Mitchell Admin)");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user