[REF] mail: move mail.message/toggle_star to new service

Part of task-3265211

Part-of: odoo/odoo#129583
This commit is contained in:
Sébastien Theys
2023-07-27 20:32:33 +02:00
parent 3cbe9d46fc
commit c3a73a1fdd
2 changed files with 7 additions and 8 deletions
@@ -55,6 +55,13 @@ export class MailCoreCommon {
this.env.bus.trigger("mail.message/delete", { message });
}
});
this.busService.subscribe("mail.message/toggle_star", (payload) => {
const { message_ids: messageIds, starred } = payload;
for (const messageId of messageIds) {
const message = this.messageService.insert({ id: messageId });
this.messageService.updateStarred(message, starred);
}
});
this.busService.subscribe("mail.record/insert", (payload) => {
if (payload.Thread) {
this.threadService.insert(payload.Thread);
@@ -128,14 +128,6 @@ export class Messaging {
handleNotification(notifications) {
for (const notif of notifications) {
switch (notif.type) {
case "mail.message/toggle_star": {
const { message_ids: messageIds, starred } = notif.payload;
for (const messageId of messageIds) {
const message = this.messageService.insert({ id: messageId });
this.messageService.updateStarred(message, starred);
}
break;
}
case "mail.message/notification_update":
{
notif.payload.elements.map((message) => {