[REF] mail: move discuss.channel/unpin to discuss folder

Part of task-3265211

Part-of: odoo/odoo#128593
This commit is contained in:
Sébastien Theys
2023-07-17 18:13:39 +02:00
parent ba5cbd21e7
commit a008feec69
3 changed files with 12 additions and 19 deletions
@@ -11,7 +11,6 @@ import { markup, reactive } from "@odoo/owl";
import { _t } from "@web/core/l10n/translation";
import { registry } from "@web/core/registry";
import { Deferred } from "@web/core/utils/concurrency";
import { sprintf } from "@web/core/utils/strings";
/**
* @typedef {Messaging} Messaging
@@ -29,7 +28,6 @@ export class Messaging {
this.orm = services.orm;
/** @type {import("@mail/core/common/attachment_service").AttachmentService} */
this.attachmentService = services["mail.attachment"];
this.notificationService = services.notification;
/** @type {import("@mail/core/common/user_settings_service").UserSettings} */
this.userSettingsService = services["mail.user_settings"];
/** @type {import("@mail/core/common/thread_service").ThreadService} */
@@ -276,21 +274,6 @@ export class Messaging {
}
break;
}
case "discuss.channel/unpin": {
const thread =
this.store.threads[createLocalId("discuss.channel", notif.payload.id)];
if (thread) {
thread.is_pinned = false;
this.notificationService.add(
sprintf(
_t("You unpinned your conversation with %s"),
thread.displayName
),
{ type: "info" }
);
}
break;
}
case "mail.message/notification_update":
{
notif.payload.elements.map((message) => {
@@ -468,7 +451,6 @@ export const messagingService = {
"router",
"bus_service",
"im_status",
"notification",
"mail.attachment",
"mail.user_settings",
"mail.thread",
@@ -11,6 +11,7 @@ patch(Messaging.prototype, "mail/core/web", {
this._super(env, services, initialThreadLocalId);
/** @type {import("@mail/core/common/chat_window_service").ChatWindow} */
this.chatWindowService = services["mail.chat_window"];
this.notificationService = services.notification;
this.ui = services["ui"];
this.bus.subscribe("res.users/connection", async ({ partnerId, username }) => {
// If the current user invited a new user, and the new user is
@@ -44,5 +45,5 @@ patch(Messaging.prototype, "mail/core/web", {
});
patch(messagingService, "mail/core/web", {
dependencies: [...messagingService.dependencies, "mail.chat_window", "ui"],
dependencies: [...messagingService.dependencies, "mail.chat_window", "notification", "ui"],
});
@@ -94,6 +94,16 @@ export class DiscussCoreCommon {
channel.messages.push(message);
channel.transientMessages.push(message);
});
this.busService.subscribe("discuss.channel/unpin", (payload) => {
const thread = this.store.threads[createLocalId("discuss.channel", payload.id)];
if (thread) {
thread.is_pinned = false;
this.notificationService.add(
sprintf(_t("You unpinned your conversation with %s"), thread.displayName),
{ type: "info" }
);
}
});
this.busService.subscribe("discuss.channel.member/fetched", (payload) => {
const { channel_id, last_message_id, partner_id } = payload;
const channel = this.store.threads[createLocalId("discuss.channel", channel_id)];