[REF] mail: move mail.activity/updated to new service
Part of task-3265211 Part-of: odoo/odoo#129583
This commit is contained in:
@@ -130,14 +130,6 @@ export class Messaging {
|
||||
handleNotification(notifications) {
|
||||
for (const notif of notifications) {
|
||||
switch (notif.type) {
|
||||
case "mail.activity/updated":
|
||||
if (notif.payload.activity_created) {
|
||||
this.store.activityCounter++;
|
||||
}
|
||||
if (notif.payload.activity_deleted) {
|
||||
this.store.activityCounter--;
|
||||
}
|
||||
break;
|
||||
case "mail.record/insert":
|
||||
this._handleNotificationRecordInsert(notif);
|
||||
break;
|
||||
|
||||
@@ -7,6 +7,7 @@ import { registry } from "@web/core/registry";
|
||||
export class MailCoreWeb {
|
||||
constructor(env, services) {
|
||||
Object.assign(this, {
|
||||
busService: services.bus_service,
|
||||
rpc: services.rpc,
|
||||
});
|
||||
/** @type {import("@mail/core/common/message_service").MessageService} */
|
||||
@@ -34,12 +35,20 @@ export class MailCoreWeb {
|
||||
(n1, n2) => n2.lastMessage.id - n1.lastMessage.id
|
||||
);
|
||||
});
|
||||
this.busService.subscribe("mail.activity/updated", (payload) => {
|
||||
if (payload.activity_created) {
|
||||
this.store.activityCounter++;
|
||||
}
|
||||
if (payload.activity_deleted) {
|
||||
this.store.activityCounter--;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const mailCoreWeb = {
|
||||
dependencies: ["mail.message", "mail.messaging", "mail.store", "rpc"],
|
||||
dependencies: ["bus_service", "mail.message", "mail.messaging", "mail.store", "rpc"],
|
||||
start(env, services) {
|
||||
const mailCoreWeb = reactive(new MailCoreWeb(env, services));
|
||||
mailCoreWeb.setup();
|
||||
|
||||
Reference in New Issue
Block a user