diff --git a/addons/im_livechat/static/src/core/messaging_service_patch.js b/addons/im_livechat/static/src/core/messaging_service_patch.js index 60c16593935..3db3aac949f 100644 --- a/addons/im_livechat/static/src/core/messaging_service_patch.js +++ b/addons/im_livechat/static/src/core/messaging_service_patch.js @@ -1,7 +1,6 @@ /* @odoo-module */ import { Messaging } from "@mail/core/common/messaging_service"; -import { createLocalId } from "@mail/utils/common/misc"; import { patch } from "@web/core/utils/patch"; @@ -12,15 +11,6 @@ patch(Messaging.prototype, "im_livechat", { this.store.discuss.livechat.isOpen = true; } }, - - _handleNotificationLastInterestDtChanged(notif) { - this._super(notif); - const channel = this.store.threads[createLocalId("discuss.channel", notif.payload.id)]; - if (channel?.type === "livechat") { - this.threadService.sortChannels(); - } - }, - _handleNotificationRecordInsert(notif) { this._super(notif); const { "res.users.settings": settings } = notif.payload; diff --git a/addons/mail/static/src/core/common/messaging_service.js b/addons/mail/static/src/core/common/messaging_service.js index b034cf6be19..bfd7ce8bd57 100644 --- a/addons/mail/static/src/core/common/messaging_service.js +++ b/addons/mail/static/src/core/common/messaging_service.js @@ -4,7 +4,6 @@ import { CannedResponse } from "@mail/core/common/canned_response_model"; import { LinkPreview } from "@mail/core/common/link_preview_model"; import { removeFromArray, removeFromArrayWithPredicate } from "@mail/utils/common/arrays"; import { cleanTerm } from "@mail/utils/common/format"; -import { createLocalId } from "@mail/utils/common/misc"; import { markup, reactive } from "@odoo/owl"; @@ -288,9 +287,6 @@ export class Messaging { }); } break; - case "discuss.channel/last_interest_dt_changed": - this._handleNotificationLastInterestDtChanged(notif); - break; case "ir.attachment/delete": { const { id: attachmentId, message: messageData } = notif.payload; @@ -309,17 +305,6 @@ export class Messaging { } } - _handleNotificationLastInterestDtChanged(notif) { - const { id, last_interest_dt } = notif.payload; - const channel = this.store.threads[createLocalId("discuss.channel", id)]; - if (channel) { - this.threadService.update(channel, { last_interest_dt }); - } - if (["chat", "group"].includes(channel?.type)) { - this.threadService.sortChannels(); - } - } - _handleNotificationRecordInsert(notif) { if (notif.payload.Thread) { this.threadService.insert(notif.payload.Thread); diff --git a/addons/mail/static/src/discuss/core/common/discuss_core_common_service.js b/addons/mail/static/src/discuss/core/common/discuss_core_common_service.js index 38b1a9e9918..de65a6a6b53 100644 --- a/addons/mail/static/src/discuss/core/common/discuss_core_common_service.js +++ b/addons/mail/static/src/discuss/core/common/discuss_core_common_service.js @@ -47,6 +47,16 @@ export class DiscussCoreCommon { ); } }); + this.busService.subscribe("discuss.channel/last_interest_dt_changed", (payload) => { + const { id, last_interest_dt } = payload; + const channel = this.store.threads[createLocalId("discuss.channel", id)]; + if (channel) { + this.threadService.update(channel, { last_interest_dt }); + if (channel.type !== "channel") { + this.threadService.sortChannels(); + } + } + }); this.busService.subscribe("discuss.channel/leave", (payload) => { const thread = this.threadService.insert({ ...payload,