+
diff --git a/addons/mail/static/src/web/chat_window/chat_window_service.js b/addons/mail/static/src/web/chat_window/chat_window_service.js
index c1e7ef25664..030cbb05b14 100644
--- a/addons/mail/static/src/web/chat_window/chat_window_service.js
+++ b/addons/mail/static/src/web/chat_window/chat_window_service.js
@@ -59,10 +59,15 @@ export class ChatWindowService {
if (this.env.isSmall) {
return;
}
- if (chatWindow.thread?.model === "mail.channel") {
- return this.orm.silent.call("mail.channel", "channel_fold", [[chatWindow.thread.id]], {
- state: chatWindow.thread.state,
- });
+ if (chatWindow.thread?.model === "discuss.channel") {
+ return this.orm.silent.call(
+ "discuss.channel",
+ "channel_fold",
+ [[chatWindow.thread.id]],
+ {
+ state: chatWindow.thread.state,
+ }
+ );
}
}
diff --git a/addons/mail/static/src/web/chatter.xml b/addons/mail/static/src/web/chatter.xml
index bd637bb36d5..662effea99c 100644
--- a/addons/mail/static/src/web/chatter.xml
+++ b/addons/mail/static/src/web/chatter.xml
@@ -28,7 +28,7 @@
-
+
Add Followers
diff --git a/addons/mail/static/src/web/command_palette.js b/addons/mail/static/src/web/command_palette.js
index a1e8d51be5d..96b0af0a554 100644
--- a/addons/mail/static/src/web/command_palette.js
+++ b/addons/mail/static/src/web/command_palette.js
@@ -57,7 +57,7 @@ commandSetupRegistry.add("#", {
placeholder: _lt("Search for a channel..."),
});
-commandProviderRegistry.add("mail.channel", {
+commandProviderRegistry.add("discuss.channel", {
namespace: "#",
async provide(env, options) {
/** @type {import("@mail/core/messaging_service").Messaging} */
@@ -68,7 +68,7 @@ commandProviderRegistry.add("mail.channel", {
["name", "ilike", cleanTerm(options.searchValue)],
];
const channelsData = await messaging.orm.searchRead(
- "mail.channel",
+ "discuss.channel",
domain,
["channel_type", "name"],
{ limit: 10 }
diff --git a/addons/mail/static/src/web/discuss/sidebar.js b/addons/mail/static/src/web/discuss/sidebar.js
index 3d3a0bdd172..e84c9e5938c 100644
--- a/addons/mail/static/src/web/discuss/sidebar.js
+++ b/addons/mail/static/src/web/discuss/sidebar.js
@@ -65,7 +65,7 @@ export class Sidebar extends Component {
this.actionService.doAction({
name: _t("Public Channels"),
type: "ir.actions.act_window",
- res_model: "mail.channel",
+ res_model: "discuss.channel",
views: [
[false, "kanban"],
[false, "form"],
@@ -79,7 +79,7 @@ export class Sidebar extends Component {
if (thread.type === "channel") {
this.actionService.doAction({
type: "ir.actions.act_window",
- res_model: "mail.channel",
+ res_model: "discuss.channel",
res_id: thread.id,
views: [[false, "form"]],
target: "current",
@@ -124,7 +124,7 @@ export class Sidebar extends Component {
get hasQuickSearch() {
return (
Object.values(this.store.threads).filter(
- (thread) => thread.is_pinned && thread.model === "mail.channel"
+ (thread) => thread.is_pinned && thread.model === "discuss.channel"
).length > 19
);
}
diff --git a/addons/mail/static/src/web/message_patch.js b/addons/mail/static/src/web/message_patch.js
index 61273c005fd..2b2b598735a 100644
--- a/addons/mail/static/src/web/message_patch.js
+++ b/addons/mail/static/src/web/message_patch.js
@@ -35,7 +35,7 @@ patch(Message.prototype, "mail/web", {
},
openRecord() {
- if (this.message.resModel === "mail.channel") {
+ if (this.message.resModel === "discuss.channel") {
this.threadService.open(this.message.originThread);
} else {
this.action.doAction({
diff --git a/addons/mail/static/src/web/messaging_service_patch.js b/addons/mail/static/src/web/messaging_service_patch.js
index e08999341cc..0c8ea928595 100644
--- a/addons/mail/static/src/web/messaging_service_patch.js
+++ b/addons/mail/static/src/web/messaging_service_patch.js
@@ -26,7 +26,7 @@ patch(Messaging.prototype, "mail/web", {
},
async _handleNotificationNewMessage(notif) {
await this._super(notif);
- const channel = this.store.threads[createLocalId("mail.channel", notif.payload.id)];
+ const channel = this.store.threads[createLocalId("discuss.channel", notif.payload.id)];
if (channel.correspondent !== this.store.odoobot) {
this.chatWindowService.insert({ thread: channel });
}
diff --git a/addons/mail/static/tests/call/call_settings_menu_tests.js b/addons/mail/static/tests/call/call_settings_menu_tests.js
index 2ee02303d45..a79f0adc2a0 100644
--- a/addons/mail/static/tests/call/call_settings_menu_tests.js
+++ b/addons/mail/static/tests/call/call_settings_menu_tests.js
@@ -28,7 +28,7 @@ QUnit.test("Renders the call settings", async (assert) => {
},
});
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "test" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "test" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await click(".o-mail-Discuss-header .fa-gear");
@@ -52,7 +52,7 @@ QUnit.test("activate push to talk", async (assert) => {
},
});
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "test" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "test" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await click(".o-mail-Discuss-header .fa-gear");
@@ -72,7 +72,7 @@ QUnit.test("activate blur", async (assert) => {
},
});
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "test" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "test" });
const { click, openDiscuss } = await start();
await openDiscuss(channelId);
await click(".o-mail-Discuss-header .fa-gear");
@@ -100,7 +100,7 @@ QUnit.test(
},
});
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await click("button[title='Show Call Settings']");
diff --git a/addons/mail/static/tests/call/call_tests.js b/addons/mail/static/tests/call/call_tests.js
index 67a7f28163a..8dd5e5a0c9e 100644
--- a/addons/mail/static/tests/call/call_tests.js
+++ b/addons/mail/static/tests/call/call_tests.js
@@ -15,7 +15,7 @@ QUnit.module("call");
QUnit.test("basic rendering", async (assert) => {
mockGetMedia();
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "General",
});
const { openDiscuss } = await start();
@@ -37,7 +37,7 @@ QUnit.test("basic rendering", async (assert) => {
QUnit.test("no call with odoobot", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: pyEnv.odoobotId }],
@@ -51,7 +51,7 @@ QUnit.test("no call with odoobot", async (assert) => {
QUnit.test("should not display call UI when no more members (self disconnect)", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await click(".o-mail-Discuss-header button[title='Start a Call']");
@@ -64,7 +64,7 @@ QUnit.test("should not display call UI when no more members (self disconnect)",
QUnit.test("show call UI in chat window when in call", async (assert) => {
mockGetMedia();
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "General" });
+ pyEnv["discuss.channel"].create({ name: "General" });
await start();
await click(".o_menu_systray i[aria-label='Messages']");
await click(".o-mail-NotificationItem:contains(General)");
@@ -86,7 +86,7 @@ QUnit.test("show call UI in chat window when in call", async (assert) => {
QUnit.test("should disconnect when closing page while in call", async (assert) => {
mockGetMedia();
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
patchWithCleanup(browser, {
@@ -169,13 +169,13 @@ QUnit.test("should display invitations", async (assert) => {
{ pure: true }
);
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const partnerId = pyEnv["res.partner"].create({ name: "InvitationSender" });
- const memberId = pyEnv["mail.channel.member"].create({
+ const memberId = pyEnv["discuss.channel.member"].create({
channel_id: channelId,
partner_id: partnerId,
});
- const sessionId = pyEnv["mail.channel.rtc.session"].create({
+ const sessionId = pyEnv["discuss.channel.rtc.session"].create({
channel_member_id: memberId,
channel_id: channelId,
});
@@ -185,7 +185,7 @@ QUnit.test("should display invitations", async (assert) => {
pyEnv["bus.bus"]._sendone(pyEnv.currentPartner, "mail.record/insert", {
Thread: {
id: channelId,
- model: "mail.channel",
+ model: "discuss.channel",
rtcInvitingSession: { id: sessionId, channelMember: { id: memberId } },
},
});
@@ -197,7 +197,7 @@ QUnit.test("should display invitations", async (assert) => {
pyEnv["bus.bus"]._sendone(pyEnv.currentPartner, "mail.record/insert", {
Thread: {
id: channelId,
- model: "mail.channel",
+ model: "discuss.channel",
rtcInvitingSession: [["unlink"]],
},
});
@@ -209,7 +209,7 @@ QUnit.test("should display invitations", async (assert) => {
QUnit.test("can share screen", async (assert) => {
mockGetMedia();
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "General",
});
const { openDiscuss } = await start();
@@ -224,7 +224,7 @@ QUnit.test("can share screen", async (assert) => {
QUnit.test("can share user camera", async (assert) => {
mockGetMedia();
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "General",
});
const { openDiscuss } = await start();
diff --git a/addons/mail/static/tests/chat_window/chat_window_manager_tests.js b/addons/mail/static/tests/chat_window/chat_window_manager_tests.js
index fb6f75225ac..7b3c479dca4 100644
--- a/addons/mail/static/tests/chat_window/chat_window_manager_tests.js
+++ b/addons/mail/static/tests/chat_window/chat_window_manager_tests.js
@@ -12,7 +12,7 @@ QUnit.module("chat window manager");
QUnit.test("chat window does not fetch messages if hidden", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create([
+ pyEnv["discuss.channel"].create([
{
channel_member_ids: [
[0, 0, { is_minimized: true, partner_id: pyEnv.currentPartnerId }],
@@ -39,7 +39,7 @@ QUnit.test("chat window does not fetch messages if hidden", async (assert) => {
);
await start({
mockRPC(route, args) {
- if (route === "/mail/channel/messages") {
+ if (route === "/discuss/channel/messages") {
assert.step("fetch_messages");
}
},
@@ -51,7 +51,7 @@ QUnit.test("chat window does not fetch messages if hidden", async (assert) => {
QUnit.test("click on hidden chat window should fetch its messages", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create([
+ pyEnv["discuss.channel"].create([
{
channel_member_ids: [
[0, 0, { is_minimized: true, partner_id: pyEnv.currentPartnerId }],
@@ -78,7 +78,7 @@ QUnit.test("click on hidden chat window should fetch its messages", async (asser
);
await start({
mockRPC(route, args) {
- if (route === "/mail/channel/messages") {
+ if (route === "/discuss/channel/messages") {
assert.step("fetch_messages");
}
},
@@ -95,7 +95,7 @@ QUnit.test(
"closing the last visible chat window should unhide the first hidden one",
async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create([
+ pyEnv["discuss.channel"].create([
{ name: "channel-A" },
{ name: "channel-B" },
{ name: "channel-C" },
diff --git a/addons/mail/static/tests/chat_window/chat_window_new_message_tests.js b/addons/mail/static/tests/chat_window/chat_window_new_message_tests.js
index 678901c2ba6..f7a64395532 100644
--- a/addons/mail/static/tests/chat_window/chat_window_new_message_tests.js
+++ b/addons/mail/static/tests/chat_window/chat_window_new_message_tests.js
@@ -77,7 +77,7 @@ QUnit.test(
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Partner 131" });
pyEnv["res.users"].create({ partner_id: partnerId });
- pyEnv["mail.channel"].create([
+ pyEnv["discuss.channel"].create([
{
name: "channel-1",
channel_member_ids: [
@@ -152,7 +152,7 @@ QUnit.test(
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Partner 131" });
pyEnv["res.users"].create({ partner_id: partnerId });
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [
[
0,
diff --git a/addons/mail/static/tests/chat_window/chat_window_tests.js b/addons/mail/static/tests/chat_window/chat_window_tests.js
index d71c566ce18..68365806978 100644
--- a/addons/mail/static/tests/chat_window/chat_window_tests.js
+++ b/addons/mail/static/tests/chat_window/chat_window_tests.js
@@ -29,7 +29,7 @@ QUnit.test(
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
const userId = pyEnv["res.users"].create({ partner_id: partnerId });
- pyEnv["mail.channel"].records = [
+ pyEnv["discuss.channel"].records = [
{
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -58,7 +58,7 @@ QUnit.test(
'chat window: post message on channel with "CTRL-Enter" keyboard shortcut for small screen size',
async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { is_minimized: true, partner_id: pyEnv.currentPartnerId }],
],
@@ -75,7 +75,7 @@ QUnit.test(
QUnit.test("load messages from opening chat window from messaging menu", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
group_public_id: false,
name: "General",
@@ -83,7 +83,7 @@ QUnit.test("load messages from opening chat window from messaging menu", async (
for (let i = 0; i <= 20; i++) {
pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
}
@@ -95,7 +95,7 @@ QUnit.test("load messages from opening chat window from messaging menu", async (
QUnit.test("chat window: basic rendering", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "General" });
+ pyEnv["discuss.channel"].create({ name: "General" });
await start();
await click(".o_menu_systray i[aria-label='Messages']");
await click(".o-mail-NotificationItem");
@@ -120,7 +120,7 @@ QUnit.test(
"Mobile: opening a chat window should not update channel state on the server",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { fold_state: "closed", partner_id: pyEnv.currentPartnerId }],
],
@@ -129,7 +129,7 @@ QUnit.test(
await start();
await click(".o_menu_systray i[aria-label='Messages']");
await click(".o-mail-NotificationItem");
- const [member] = pyEnv["mail.channel.member"].searchRead([
+ const [member] = pyEnv["discuss.channel.member"].searchRead([
["channel_id", "=", channelId],
["partner_id", "=", pyEnv.currentPartnerId],
]);
@@ -139,7 +139,7 @@ QUnit.test(
QUnit.test("chat window: fold", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({});
+ pyEnv["discuss.channel"].create({});
await start({
mockRPC(route, args) {
if (args.method === "channel_fold") {
@@ -166,7 +166,7 @@ QUnit.test("chat window: fold", async (assert) => {
QUnit.test("chat window: open / close", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({});
+ pyEnv["discuss.channel"].create({});
await start({
mockRPC(route, args) {
if (args.method === "channel_fold") {
@@ -196,7 +196,7 @@ QUnit.test(
"Mobile: closing a chat window should not update channel state on the server",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { fold_state: "open", partner_id: pyEnv.currentPartnerId }],
],
@@ -209,7 +209,7 @@ QUnit.test(
// Close chat window
await click(".o-mail-ChatWindow-command[title='Close chat window']");
assert.containsNone($, ".o-mail-ChatWindow");
- const [member] = pyEnv["mail.channel.member"].searchRead([
+ const [member] = pyEnv["discuss.channel.member"].searchRead([
["channel_id", "=", channelId],
["partner_id", "=", pyEnv.currentPartnerId],
]);
@@ -219,7 +219,7 @@ QUnit.test(
QUnit.test("chat window: close on ESCAPE", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [[0, 0, { is_minimized: true, partner_id: pyEnv.currentPartnerId }]],
});
await start({
@@ -246,7 +246,7 @@ QUnit.test(
name: "TestPartner",
});
pyEnv["res.users"].create({ partner_id: partnerId });
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
name: "general",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId, is_minimized: true }],
@@ -264,7 +264,7 @@ QUnit.test(
"Close emoji picker in chat window with ESCAPE does not also close the chat window",
async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
name: "general",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId, is_minimized: true }],
@@ -280,7 +280,7 @@ QUnit.test(
QUnit.test("open 2 different chat windows: enough screen width [REQUIRE FOCUS]", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create([{ name: "Channel_1" }, { name: "Channel_2" }]);
+ pyEnv["discuss.channel"].create([{ name: "Channel_1" }, { name: "Channel_2" }]);
patchUiSize({ width: 1920 });
assert.ok(
CHAT_WINDOW_END_GAP_WIDTH * 2 + CHAT_WINDOW_WIDTH * 2 + CHAT_WINDOW_INBETWEEN_WIDTH < 1920,
@@ -313,7 +313,7 @@ QUnit.test("open 2 different chat windows: enough screen width [REQUIRE FOCUS]",
QUnit.test("open 3 different chat windows: not enough screen width", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create([
+ pyEnv["discuss.channel"].create([
{ name: "Channel_1" },
{ name: "Channel_2" },
{ name: "Channel_3" },
@@ -359,7 +359,7 @@ QUnit.test(
"focus next visible chat window when closing current chat window with ESCAPE [REQUIRE FOCUS]",
async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create([
+ pyEnv["discuss.channel"].create([
{
name: "General",
channel_member_ids: [
@@ -415,7 +415,7 @@ QUnit.test(
QUnit.test("chat window: switch on TAB", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create([{ name: "channel1" }, { name: "channel2" }]);
+ pyEnv["discuss.channel"].create([{ name: "channel1" }, { name: "channel2" }]);
patchUiSize({ width: 1920 });
assert.ok(
CHAT_WINDOW_END_GAP_WIDTH * 2 + CHAT_WINDOW_WIDTH * 2 + CHAT_WINDOW_INBETWEEN_WIDTH < 1920,
@@ -465,7 +465,7 @@ QUnit.test("chat window: switch on TAB", async (assert) => {
QUnit.test("chat window: TAB cycle with 3 open chat windows [REQUIRE FOCUS]", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create([
+ pyEnv["discuss.channel"].create([
{
name: "General",
channel_member_ids: [
@@ -554,7 +554,7 @@ QUnit.test(
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
const userId = pyEnv["res.users"].create({ name: "Foreigner user", partner_id: partnerId });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[
0,
@@ -572,14 +572,14 @@ QUnit.test(
});
const messageId = pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
- const [memberId] = pyEnv["mail.channel.member"].search([
+ const [memberId] = pyEnv["discuss.channel.member"].search([
["channel_id", "=", channelId],
["partner_id", "=", pyEnv.currentPartnerId],
]);
- pyEnv["mail.channel.member"].write([memberId], { seen_message_id: messageId });
+ pyEnv["discuss.channel.member"].write([memberId], { seen_message_id: messageId });
const { env } = await start();
// simulate receiving a message
await afterNextRender(async () =>
@@ -604,7 +604,7 @@ QUnit.test(
name: "Foreigner user",
partner_id: partnerId,
});
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: partnerId }],
@@ -629,7 +629,7 @@ QUnit.test("chat window should open when receiving a new DM", async (assert) =>
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({});
const userId = pyEnv["res.users"].create({ partner_id: partnerId });
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { is_pinned: false, partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: partnerId }],
@@ -654,7 +654,7 @@ QUnit.test("chat window should open when receiving a new DM", async (assert) =>
QUnit.test("chat window should not open when receiving a new DM from odoobot", async (assert) => {
const pyEnv = await startServer();
const userId = pyEnv["res.users"].create({ partner_id: pyEnv.odoobotId });
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { is_pinned: false, partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: pyEnv.odoobotId }],
@@ -678,7 +678,7 @@ QUnit.test(
"chat window should scroll to the newly posted message just after posting it",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[
0,
@@ -690,7 +690,7 @@ QUnit.test(
for (let i = 0; i < 10; i++) {
pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
}
@@ -712,7 +712,7 @@ QUnit.test("chat window should remain folded when new message is received", asyn
name: "Foreigner user",
partner_id: partnerId,
});
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [
[
0,
@@ -744,7 +744,7 @@ QUnit.test(
"should not have chat window hidden menu in mobile (transition from 3 chat windows in desktop to mobile)",
async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create([
+ pyEnv["discuss.channel"].create([
{ name: "Channel-1" },
{ name: "Channel-2" },
{ name: "Channel-3" },
@@ -779,7 +779,7 @@ QUnit.test(
QUnit.test("chat window: composer state conservation on toggle discuss", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({});
+ const channelId = pyEnv["discuss.channel"].create({});
const { openDiscuss, openView } = await start();
await click(".o_menu_systray i[aria-label='Messages']");
await click(".o-mail-NotificationItem");
@@ -808,7 +808,7 @@ QUnit.test("chat window: composer state conservation on toggle discuss", async (
await openView({
res_id: channelId,
- res_model: "mail.channel",
+ res_model: "discuss.channel",
views: [[false, "form"]],
});
assert.strictEqual($(".o-mail-Composer-input").val(), "XDU for the win !");
@@ -824,7 +824,7 @@ QUnit.test(
name: "Foreigner user",
partner_id: partnerId,
});
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
channel_member_ids: [
[
@@ -844,15 +844,15 @@ QUnit.test(
const messageId = pyEnv["mail.message"].create([
{
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
]);
- const [memberId] = pyEnv["mail.channel.member"].search([
+ const [memberId] = pyEnv["discuss.channel.member"].search([
["channel_id", "=", channelId],
["partner_id", "=", pyEnv.currentPartnerId],
]);
- pyEnv["mail.channel.member"].write([memberId], { seen_message_id: messageId });
+ pyEnv["discuss.channel.member"].write([memberId], { seen_message_id: messageId });
const { env } = await start();
$(".o-mail-Composer-input")[0].blur();
// simulate receiving a message
@@ -871,11 +871,11 @@ QUnit.test(
QUnit.test("chat window: scroll conservation on toggle discuss", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({});
+ const channelId = pyEnv["discuss.channel"].create({});
for (let i = 0; i < 100; i++) {
pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
}
@@ -888,7 +888,7 @@ QUnit.test("chat window: scroll conservation on toggle discuss", async (assert)
await openView({
res_id: channelId,
- res_model: "mail.channel",
+ res_model: "discuss.channel",
views: [[false, "list"]],
});
assert.strictEqual($(".o-mail-Thread")[0].scrollTop, 142);
@@ -898,11 +898,11 @@ QUnit.test(
"chat window with a thread: keep scroll position in message list on folded",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({});
+ const channelId = pyEnv["discuss.channel"].create({});
for (let i = 0; i < 100; i++) {
pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
}
@@ -926,11 +926,11 @@ QUnit.test(
"chat window with a thread: keep scroll position in message list on toggle discuss when folded",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({});
+ const channelId = pyEnv["discuss.channel"].create({});
for (let i = 0; i < 100; i++) {
pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
}
@@ -947,7 +947,7 @@ QUnit.test(
await openView({
res_id: channelId,
- res_model: "mail.channel",
+ res_model: "discuss.channel",
views: [[false, "list"]],
});
// unfold chat window
@@ -958,7 +958,7 @@ QUnit.test(
QUnit.test("folded chat window should hide member-list and settings buttons", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({});
+ pyEnv["discuss.channel"].create({});
await start();
// Open Thread
await click("button i[aria-label='Messages']");
@@ -979,7 +979,7 @@ QUnit.test("folded chat window should hide member-list and settings buttons", as
QUnit.test("Chat window in mobile are not foldable", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [[0, 0, { fold_state: "open", partner_id: pyEnv.currentPartnerId }]],
});
patchUiSize({ size: SIZES.SM });
diff --git a/addons/mail/static/tests/composer/composer_tests.js b/addons/mail/static/tests/composer/composer_tests.js
index 32bc2398467..f110885778b 100644
--- a/addons/mail/static/tests/composer/composer_tests.js
+++ b/addons/mail/static/tests/composer/composer_tests.js
@@ -64,10 +64,10 @@ QUnit.test("composer text input: basic rendering when logging note", async (asse
});
QUnit.test(
- "composer text input: basic rendering when linked thread is a mail.channel",
+ "composer text input: basic rendering when linked thread is a discuss.channel",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "dofus-disco" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "dofus-disco" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
assert.containsOnce($, ".o-mail-Composer");
@@ -79,7 +79,7 @@ QUnit.test(
"composer text input placeholder should contain channel name when thread does not have specific correspondent",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "General",
});
@@ -91,7 +91,7 @@ QUnit.test(
QUnit.test("add an emoji", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "swamp-safari" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "swamp-safari" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await click("button[aria-label='Emojis']");
@@ -103,7 +103,7 @@ QUnit.test(
"Exiting emoji picker brings the focus back to the Composer textarea",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await click("button[aria-label='Emojis']");
@@ -114,7 +114,7 @@ QUnit.test(
QUnit.test("add an emoji after some text", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "beyblade-room" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "beyblade-room" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await insertText(".o-mail-Composer-input", "Blabla");
@@ -127,7 +127,7 @@ QUnit.test("add an emoji after some text", async (assert) => {
QUnit.test("add emoji replaces (keyboard) text selection", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "pétanque-tournament-14" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "pétanque-tournament-14" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
const textarea = $(".o-mail-Composer-input")[0];
@@ -143,7 +143,7 @@ QUnit.test("add emoji replaces (keyboard) text selection", async (assert) => {
QUnit.test("Cursor is positioned after emoji after adding it", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "pétanque-tournament-14" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "pétanque-tournament-14" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
const textarea = $(".o-mail-Composer-input")[0];
@@ -158,7 +158,7 @@ QUnit.test("Cursor is positioned after emoji after adding it", async (assert) =>
QUnit.test("selected text is not replaced after cancelling the selection", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "pétanque-tournament-14" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "pétanque-tournament-14" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
const textarea = $(".o-mail-Composer-input")[0];
@@ -178,7 +178,7 @@ QUnit.test(
"Selection is kept when changing channel and going back to original channel",
async (assert) => {
const pyEnv = await startServer();
- const [channelId] = pyEnv["mail.channel"].create([
+ const [channelId] = pyEnv["discuss.channel"].create([
{ name: "channel1" },
{ name: "channel2" },
]);
@@ -199,7 +199,7 @@ QUnit.test(
"click on emoji button, select emoji, then re-click on button should show emoji picker",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "roblox-skateboarding" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "roblox-skateboarding" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await click("button[aria-label='Emojis']");
@@ -211,7 +211,7 @@ QUnit.test(
QUnit.test("keep emoji picker scroll value when re-opening it", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "roblox-carsurfing" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "roblox-carsurfing" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await click("button[aria-label='Emojis']");
@@ -223,7 +223,7 @@ QUnit.test("keep emoji picker scroll value when re-opening it", async (assert) =
QUnit.test("reset emoji picker scroll value after an emoji is picked", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "roblox-fingerskating" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "roblox-fingerskating" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await click("button[aria-label='Emojis']");
@@ -237,14 +237,14 @@ QUnit.test(
"keep emoji picker scroll value independent if two or more different emoji pickers are used",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "roblox-jaywalking" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "roblox-jaywalking" });
const { openDiscuss } = await start();
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "This is a message",
attachment_ids: [],
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
await openDiscuss(channelId);
@@ -269,10 +269,10 @@ QUnit.test(
QUnit.test('do not send typing notification on typing "/" command', async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "channel" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "channel" });
const { openDiscuss } = await start({
async mockRPC(route, args) {
- if (route === "/mail/channel/notify_typing") {
+ if (route === "/discuss/channel/notify_typing") {
assert.step(`notify_typing:${args.is_typing}`);
}
},
@@ -284,7 +284,7 @@ QUnit.test('do not send typing notification on typing "/" command', async (asser
QUnit.test("composer text input cleared on message post", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "au-secours-aidez-moi" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "au-secours-aidez-moi" });
const { openDiscuss } = await start({
async mockRPC(route, args) {
if (route === "/mail/message/post") {
@@ -303,7 +303,7 @@ QUnit.test("composer text input cleared on message post", async (assert) => {
QUnit.test("send message only once when button send is clicked twice quickly", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "nether-picnic" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "nether-picnic" });
const { openDiscuss } = await start({
async mockRPC(route, args) {
if (route === "/mail/message/post") {
@@ -320,9 +320,9 @@ QUnit.test("send message only once when button send is clicked twice quickly", a
assert.verifySteps(["message_post"]);
});
-QUnit.test('send button on mail.channel should have "Send" as label', async (assert) => {
+QUnit.test('send button on discuss.channel should have "Send" as label', async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "minecraft-wii-u" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "minecraft-wii-u" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
assert.strictEqual($(".o-mail-Composer-send").text().trim(), "Send");
@@ -331,7 +331,7 @@ QUnit.test('send button on mail.channel should have "Send" as label', async (ass
QUnit.test("Show send button in mobile", async (assert) => {
const pyEnv = await startServer();
patchUiSize({ size: SIZES.SM });
- pyEnv["mail.channel"].create({ name: "minecraft-wii-u" });
+ pyEnv["discuss.channel"].create({ name: "minecraft-wii-u" });
const { openDiscuss } = await start();
await openDiscuss();
await click("button:contains(Channel)");
@@ -344,7 +344,7 @@ QUnit.test(
"composer textarea content is retained when changing channel then going back",
async (assert) => {
const pyEnv = await startServer();
- const [channelId] = pyEnv["mail.channel"].create([
+ const [channelId] = pyEnv["discuss.channel"].create([
{ name: "minigolf-galaxy-iv" },
{ name: "epic-shrek-lovers" },
]);
@@ -364,10 +364,10 @@ QUnit.test(
'do not send typing notification on typing after selecting suggestion from "/" command',
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "channel" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "channel" });
const { openDiscuss } = await start({
async mockRPC(route, args) {
- if (route === "/mail/channel/notify_typing") {
+ if (route === "/discuss/channel/notify_typing") {
assert.step(`notify_typing:${args.is_typing}`);
}
},
@@ -382,7 +382,7 @@ QUnit.test(
QUnit.test("add an emoji after a command", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "General",
channel_type: "channel",
});
@@ -409,7 +409,7 @@ QUnit.test("add an emoji after a partner mention", async (assert) => {
email: "testpartner@odoo.com",
name: "TestPartner",
});
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "Mario Party",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -433,7 +433,7 @@ QUnit.test("add an emoji after a partner mention", async (assert) => {
QUnit.test("mention a channel after some text", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "General",
channel_type: "channel",
});
@@ -459,7 +459,7 @@ QUnit.test("mention a channel after some text", async (assert) => {
QUnit.test("add an emoji after a channel mention", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "General",
channel_type: "channel",
});
@@ -499,7 +499,7 @@ QUnit.test(
'do not post message on channel with "SHIFT-Enter" keyboard shortcut',
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
assert.containsNone($, ".o-mail-Message");
@@ -513,7 +513,7 @@ QUnit.test(
QUnit.test('post message on channel with "Enter" keyboard shortcut', async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
assert.containsNone($, ".o-mail-Message");
@@ -526,7 +526,7 @@ QUnit.test('post message on channel with "Enter" keyboard shortcut', async (asse
QUnit.test("leave command on channel", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const { openDiscuss } = await start({
services: {
notification: makeFakeNotificationService((message) => {
@@ -546,7 +546,7 @@ QUnit.test("leave command on channel", async (assert) => {
QUnit.test("leave command on chat", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Chuck Norris" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: partnerId }],
@@ -571,7 +571,7 @@ QUnit.test("leave command on chat", async (assert) => {
QUnit.test("Can post suggestions", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
insertText(".o-mail-Composer-input", "#");
@@ -589,7 +589,7 @@ QUnit.test(
async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Marc Demo" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: partnerId }],
@@ -604,7 +604,7 @@ QUnit.test(
QUnit.test("send message only once when enter is pressed twice quickly", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const { openDiscuss } = await start({
async mockRPC(route, args) {
if (route === "/mail/message/post") {
@@ -623,13 +623,13 @@ QUnit.test("send message only once when enter is pressed twice quickly", async (
QUnit.test("quick edit last self-message from UP arrow", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "Test",
attachment_ids: [],
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -648,7 +648,7 @@ QUnit.test("Select composer suggestion via Enter does not send the message", asy
name: "Shrek",
});
pyEnv["res.users"].create({ partner_id: partnerId });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -672,7 +672,7 @@ QUnit.test("Select composer suggestion via Enter does not send the message", asy
QUnit.test("composer: drop attachments", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
const files = [
@@ -713,7 +713,7 @@ QUnit.test("composer: drop attachments", async (assert) => {
QUnit.test("composer: add an attachment", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
const file = await createFile({
@@ -730,10 +730,10 @@ QUnit.test("composer: add an attachment", async (assert) => {
QUnit.test("composer: add an attachment in reply to message in history", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const messageId = pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
history_partner_ids: [pyEnv.currentPartnerId],
res_id: channelId,
});
@@ -763,7 +763,7 @@ QUnit.test(
async (assert) => {
const pyEnv = await startServer();
const attachmentUploadedPromise = makeDeferred();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const { openDiscuss } = await start({
async mockRPC(route) {
if (route === "/mail/attachment/upload") {
@@ -793,7 +793,7 @@ QUnit.test(
QUnit.test("remove an attachment from composer does not need any confirmation", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
const file = await createFile({
@@ -812,7 +812,7 @@ QUnit.test("remove an attachment from composer does not need any confirmation",
QUnit.test("composer: paste attachments", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "test" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "test" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
const files = [
@@ -830,7 +830,7 @@ QUnit.test("composer: paste attachments", async (assert) => {
QUnit.test("Replying on a channel should focus composer initially", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "general",
});
@@ -838,7 +838,7 @@ QUnit.test("Replying on a channel should focus composer initially", async (asser
body: "Hello world",
res_id: channelId,
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
});
const { openDiscuss } = await start();
await openDiscuss(channelId);
@@ -848,7 +848,7 @@ QUnit.test("Replying on a channel should focus composer initially", async (asser
QUnit.test("remove an uploading attachment", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "test" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "test" });
const { openDiscuss } = await start({
async mockRPC(route) {
if (route === "/mail/attachment/upload") {
@@ -898,7 +898,7 @@ QUnit.test(
const pyEnv = await startServer();
// Promise to block attachment uploading
const uploadPromise = makeDeferred();
- const channelId = pyEnv["mail.channel"].create({ name: "test" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "test" });
const { openDiscuss } = await start({
async mockRPC(route, args) {
if (route === "/mail/attachment/upload") {
@@ -933,7 +933,7 @@ QUnit.test(
const pyEnv = await startServer();
// Promise to block attachment uploading
const uploadPromise = makeDeferred();
- const channelId = pyEnv["mail.channel"].create({ name: "test" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "test" });
const { openDiscuss } = await start({
async mockRPC(route, args) {
if (route === "/mail/attachment/upload") {
@@ -965,7 +965,7 @@ QUnit.test(
QUnit.test("Message is sent only once when pressing enter twice in a row", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await insertText(".o-mail-Composer-input", "Hello World!");
diff --git a/addons/mail/static/tests/composer/typing_tests.js b/addons/mail/static/tests/composer/typing_tests.js
index e619a52d335..39aacd54f72 100644
--- a/addons/mail/static/tests/composer/typing_tests.js
+++ b/addons/mail/static/tests/composer/typing_tests.js
@@ -16,7 +16,7 @@ QUnit.module("typing");
QUnit.test('receive other member typing status "is typing"', async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "channel",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -29,7 +29,7 @@ QUnit.test('receive other member typing status "is typing"', async (assert) => {
// simulate receive typing notification from demo
await afterNextRender(() =>
- env.services.rpc("/mail/channel/notify_typing", {
+ env.services.rpc("/discuss/channel/notify_typing", {
channel_id: channelId,
context: { mockedPartnerId: partnerId },
is_typing: true,
@@ -43,7 +43,7 @@ QUnit.test(
async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "channel",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -56,7 +56,7 @@ QUnit.test(
// simulate receive typing notification from demo "is typing"
await afterNextRender(() =>
- env.services.rpc("/mail/channel/notify_typing", {
+ env.services.rpc("/discuss/channel/notify_typing", {
channel_id: channelId,
context: { mockedPartnerId: partnerId },
is_typing: true,
@@ -66,7 +66,7 @@ QUnit.test(
// simulate receive typing notification from demo "is no longer typing"
await afterNextRender(() =>
- env.services.rpc("/mail/channel/notify_typing", {
+ env.services.rpc("/discuss/channel/notify_typing", {
channel_id: channelId,
context: { mockedPartnerId: partnerId },
is_typing: false,
@@ -81,7 +81,7 @@ QUnit.test(
async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "channel",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -95,7 +95,7 @@ QUnit.test(
// simulate receive typing notification from demo "is typing"
await afterNextRender(() =>
- env.services.rpc("/mail/channel/notify_typing", {
+ env.services.rpc("/discuss/channel/notify_typing", {
channel_id: channelId,
context: { mockedPartnerId: partnerId },
is_typing: true,
@@ -113,7 +113,7 @@ QUnit.test(
async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "channel",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -126,7 +126,7 @@ QUnit.test(
// simulate receive typing notification from demo "is typing"
await afterNextRender(() =>
- env.services.rpc("/mail/channel/notify_typing", {
+ env.services.rpc("/discuss/channel/notify_typing", {
channel_id: channelId,
context: {
mockedPartnerId: partnerId,
@@ -138,7 +138,7 @@ QUnit.test(
// simulate receive typing notification from demo "is typing" again after long time.
await advanceTime(LONG_TYPING);
- env.services.rpc("/mail/channel/notify_typing", {
+ env.services.rpc("/discuss/channel/notify_typing", {
channel_id: channelId,
context: { mockedPartnerId: partnerId },
is_typing: true,
@@ -159,7 +159,7 @@ QUnit.test('receive several other members typing status "is typing"', async (ass
{ name: "Other 11" },
{ name: "Other 12" },
]);
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "channel",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -174,7 +174,7 @@ QUnit.test('receive several other members typing status "is typing"', async (ass
// simulate receive typing notification from other 10 (is typing)
await afterNextRender(() =>
- env.services.rpc("/mail/channel/notify_typing", {
+ env.services.rpc("/discuss/channel/notify_typing", {
channel_id: channelId,
context: { mockedPartnerId: partnerId_1 },
is_typing: true,
@@ -184,7 +184,7 @@ QUnit.test('receive several other members typing status "is typing"', async (ass
// simulate receive typing notification from other 11 (is typing)
await afterNextRender(() =>
- env.services.rpc("/mail/channel/notify_typing", {
+ env.services.rpc("/discuss/channel/notify_typing", {
channel_id: channelId,
context: { mockedPartnerId: partnerId_2 },
is_typing: true,
@@ -198,7 +198,7 @@ QUnit.test('receive several other members typing status "is typing"', async (ass
// simulate receive typing notification from other 12 (is typing)
await afterNextRender(() =>
- env.services.rpc("/mail/channel/notify_typing", {
+ env.services.rpc("/discuss/channel/notify_typing", {
channel_id: channelId,
context: { mockedPartnerId: partnerId_3 },
is_typing: true,
@@ -208,7 +208,7 @@ QUnit.test('receive several other members typing status "is typing"', async (ass
// simulate receive typing notification from other 10 (no longer is typing)
await afterNextRender(() =>
- env.services.rpc("/mail/channel/notify_typing", {
+ env.services.rpc("/discuss/channel/notify_typing", {
channel_id: channelId,
context: { mockedPartnerId: partnerId_1 },
is_typing: false,
@@ -218,7 +218,7 @@ QUnit.test('receive several other members typing status "is typing"', async (ass
// simulate receive typing notification from other 10 (is typing again)
await afterNextRender(() =>
- env.services.rpc("/mail/channel/notify_typing", {
+ env.services.rpc("/discuss/channel/notify_typing", {
channel_id: channelId,
context: { mockedPartnerId: partnerId_1 },
is_typing: true,
@@ -233,10 +233,10 @@ QUnit.test('receive several other members typing status "is typing"', async (ass
QUnit.test("current partner notify is typing to other thread members", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const { openDiscuss } = await start({
async mockRPC(route, args) {
- if (route === "/mail/channel/notify_typing") {
+ if (route === "/discuss/channel/notify_typing") {
assert.step(`notify_typing:${args.is_typing}`);
}
},
@@ -250,11 +250,11 @@ QUnit.test(
"current partner notify is typing again to other members for long continuous typing",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const { advanceTime, openDiscuss } = await start({
hasTimeControl: true,
async mockRPC(route, args) {
- if (route === "/mail/channel/notify_typing") {
+ if (route === "/discuss/channel/notify_typing") {
assert.step(`notify_typing:${args.is_typing}`);
}
},
@@ -279,11 +279,11 @@ QUnit.test(
"current partner notify no longer is typing to thread members after 5 seconds inactivity",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const { advanceTime, openDiscuss } = await start({
hasTimeControl: true,
async mockRPC(route, args) {
- if (route === "/mail/channel/notify_typing") {
+ if (route === "/discuss/channel/notify_typing") {
assert.step(`notify_typing:${args.is_typing}`);
}
},
@@ -301,11 +301,11 @@ QUnit.test(
"current partner is typing should not translate on textual typing status",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const { openDiscuss } = await start({
hasTimeControl: true,
async mockRPC(route, args) {
- if (route === "/mail/channel/notify_typing") {
+ if (route === "/discuss/channel/notify_typing") {
assert.step(`notify_typing:${args.is_typing}`);
}
},
@@ -325,7 +325,7 @@ QUnit.test("chat: correspondent is typing", async (assert) => {
im_status: "online",
name: "Demo",
});
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: partnerId }],
@@ -339,7 +339,7 @@ QUnit.test("chat: correspondent is typing", async (assert) => {
// simulate receive typing notification from demo "is typing"
await afterNextRender(() =>
- env.services.rpc("/mail/channel/notify_typing", {
+ env.services.rpc("/discuss/channel/notify_typing", {
channel_id: channelId,
context: { mockedPartnerId: partnerId },
is_typing: true,
@@ -350,7 +350,7 @@ QUnit.test("chat: correspondent is typing", async (assert) => {
// simulate receive typing notification from demo "no longer is typing"
await afterNextRender(() =>
- env.services.rpc("/mail/channel/notify_typing", {
+ env.services.rpc("/discuss/channel/notify_typing", {
channel_id: channelId,
context: { mockedPartnerId: partnerId },
is_typing: false,
diff --git a/addons/mail/static/tests/core/open_chat_test.js b/addons/mail/static/tests/core/open_chat_test.js
index 3a58d73d47a..4a111c60ff0 100644
--- a/addons/mail/static/tests/core/open_chat_test.js
+++ b/addons/mail/static/tests/core/open_chat_test.js
@@ -55,7 +55,7 @@ QUnit.test("openChat: open existing chat for user", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({});
pyEnv["res.users"].create({ partner_id: partnerId });
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId, fold_state: "open", is_minimized: true }],
[0, 0, { partner_id: partnerId }],
diff --git a/addons/mail/static/tests/core/out_of_focus_tests.js b/addons/mail/static/tests/core/out_of_focus_tests.js
index 7031e792c58..62c2a78ac7d 100644
--- a/addons/mail/static/tests/core/out_of_focus_tests.js
+++ b/addons/mail/static/tests/core/out_of_focus_tests.js
@@ -14,7 +14,7 @@ QUnit.test("Spaces in notifications are not encoded", async (assert) => {
presence: makeFakePresenceService({ isOdooFocused: () => false }),
},
});
- const channelId = pyEnv["mail.channel"].create({ channel_type: "chat" });
+ const channelId = pyEnv["discuss.channel"].create({ channel_type: "chat" });
await openDiscuss();
await env.services.rpc("/mail/message/post", {
post_data: {
@@ -22,7 +22,7 @@ QUnit.test("Spaces in notifications are not encoded", async (assert) => {
attachment_ids: [],
},
thread_id: channelId,
- thread_model: "mail.channel",
+ thread_model: "discuss.channel",
});
await nextTick();
assert.verifySteps(["Hello world!"]);
diff --git a/addons/mail/static/tests/crosstab/crosstab_tests.js b/addons/mail/static/tests/crosstab/crosstab_tests.js
index 606580c171f..c21a3c77c82 100644
--- a/addons/mail/static/tests/crosstab/crosstab_tests.js
+++ b/addons/mail/static/tests/crosstab/crosstab_tests.js
@@ -15,7 +15,7 @@ QUnit.module("crosstab");
QUnit.test("Messages are received cross-tab", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "General",
});
const tab1 = await start({ asTab: true });
@@ -30,12 +30,12 @@ QUnit.test("Messages are received cross-tab", async (assert) => {
QUnit.test("Delete starred message updates counter", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "General",
});
const messageId = pyEnv["mail.message"].create({
body: "Hello World!",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
starred_partner_ids: [pyEnv.currentPartnerId],
});
@@ -56,7 +56,7 @@ QUnit.test("Delete starred message updates counter", async (assert) => {
QUnit.test("Thread rename", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const tab1 = await start({ asTab: true });
const tab2 = await start({ asTab: true });
await tab1.openDiscuss(channelId);
@@ -69,7 +69,7 @@ QUnit.test("Thread rename", async (assert) => {
QUnit.test("Thread description update", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const tab1 = await start({ asTab: true });
const tab2 = await start({ asTab: true });
await tab1.openDiscuss(channelId);
@@ -86,7 +86,7 @@ QUnit.test("Thread description update", async (assert) => {
QUnit.test("Channel subscription is renewed when channel is manually added", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "General", channel_member_ids: [] });
+ pyEnv["discuss.channel"].create({ name: "General", channel_member_ids: [] });
const { env, openDiscuss } = await start();
patchWithCleanup(env.services["bus_service"], {
forceUpdateChannels() {
@@ -102,7 +102,7 @@ QUnit.test("Channel subscription is renewed when channel is manually added", asy
QUnit.test("Channel subscription is renewed when channel is added from invite", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "Sales", channel_member_ids: [] });
+ const channelId = pyEnv["discuss.channel"].create({ name: "Sales", channel_member_ids: [] });
const { env, openDiscuss } = await start();
patchWithCleanup(env.services["bus_service"], {
forceUpdateChannels() {
@@ -112,7 +112,7 @@ QUnit.test("Channel subscription is renewed when channel is added from invite",
await openDiscuss();
// simulate receiving invite
await afterNextRender(() => {
- env.services.orm.call("mail.channel", "add_members", [[channelId]], {
+ env.services.orm.call("discuss.channel", "add_members", [[channelId]], {
partner_ids: [pyEnv.currentPartnerId],
});
});
@@ -121,7 +121,7 @@ QUnit.test("Channel subscription is renewed when channel is added from invite",
QUnit.test("Channel subscription is renewed when channel is left", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "Sales" });
+ pyEnv["discuss.channel"].create({ name: "Sales" });
const { env, openDiscuss } = await start();
patchWithCleanup(env.services["bus_service"], {
forceUpdateChannels() {
@@ -135,10 +135,10 @@ QUnit.test("Channel subscription is renewed when channel is left", async (assert
QUnit.test("Adding attachments", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "Hogwarts Legacy" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "Hogwarts Legacy" });
const messageId = pyEnv["mail.message"].create({
body: "Hello world!",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -162,7 +162,7 @@ QUnit.test("Adding attachments", async (assert) => {
QUnit.test("Remove attachment from message", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const attachmentId = pyEnv["ir.attachment"].create({
name: "test.txt",
mimetype: "text/plain",
@@ -171,7 +171,7 @@ QUnit.test("Remove attachment from message", async (assert) => {
attachment_ids: [attachmentId],
body: "Hello World!",
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const tab1 = await start({ asTab: true });
@@ -186,7 +186,7 @@ QUnit.test("Remove attachment from message", async (assert) => {
QUnit.test("Add member to channel", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const userId = pyEnv["res.users"].create({ name: "Harry" });
pyEnv["res.partner"].create({ name: "Harry", user_ids: [userId] });
const { openDiscuss } = await start();
@@ -206,7 +206,7 @@ QUnit.test("Remove member from channel", async (assert) => {
name: "Harry",
user_ids: [userId],
});
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "General",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -217,7 +217,7 @@ QUnit.test("Remove member from channel", async (assert) => {
await openDiscuss(channelId);
await click("button[title='Show Member List']");
assert.containsOnce($, ".o-mail-ChannelMember:contains(Harry)");
- env.services.orm.call("mail.channel", "action_unfollow", [channelId], {
+ env.services.orm.call("discuss.channel", "action_unfollow", [channelId], {
context: { mockedUserId: userId },
});
});
@@ -226,7 +226,7 @@ QUnit.test("Message delete notification", async (assert) => {
const pyEnv = await startServer();
const messageId = pyEnv["mail.message"].create({
body: "Needaction message",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: pyEnv.currentPartnerId,
needaction: true,
needaction_partner_ids: [pyEnv.currentPartnerId], // not needed, for consistency
diff --git a/addons/mail/static/tests/discuss/channel_invitation_tests.js b/addons/mail/static/tests/discuss/channel_invitation_tests.js
index 3b96b9f8c8f..f8ab5ec7882 100644
--- a/addons/mail/static/tests/discuss/channel_invitation_tests.js
+++ b/addons/mail/static/tests/discuss/channel_invitation_tests.js
@@ -13,7 +13,7 @@ QUnit.test(
name: "TestPartner",
});
pyEnv["res.users"].create({ partner_id: partnerId });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "TestChanel",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -42,7 +42,7 @@ QUnit.test(
});
pyEnv["res.users"].create({ partner_id: partnerId_1 });
pyEnv["res.users"].create({ partner_id: partnerId_2 });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "TestChanel",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -68,7 +68,7 @@ QUnit.test("Invitation form should display channel group restriction", async (as
const groupId = pyEnv["res.groups"].create({
name: "testGroup",
});
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "TestChanel",
channel_member_ids: [[0, 0, { partner_id: pyEnv.currentPartnerId }]],
channel_type: "channel",
@@ -95,7 +95,7 @@ QUnit.test("should be able to create a new group chat from an existing chat", as
});
pyEnv["res.users"].create({ partner_id: partnerId_1 });
pyEnv["res.users"].create({ partner_id: partnerId_2 });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "TestChanel",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
diff --git a/addons/mail/static/tests/discuss/channel_member_list_tests.js b/addons/mail/static/tests/discuss/channel_member_list_tests.js
index b970ad39271..14050698b0a 100644
--- a/addons/mail/static/tests/discuss/channel_member_list_tests.js
+++ b/addons/mail/static/tests/discuss/channel_member_list_tests.js
@@ -11,7 +11,7 @@ QUnit.test(
async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "TestChanel",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -30,7 +30,7 @@ QUnit.test(
async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "TestChanel",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -48,7 +48,7 @@ QUnit.test(
QUnit.test("should have correct members in member list", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "TestChanel",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -69,7 +69,7 @@ QUnit.test(
async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "TestChanel",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -88,7 +88,7 @@ QUnit.test("chat with member should be opened after clicking on channel member",
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
pyEnv["res.users"].create({ partner_id: partnerId });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "TestChanel",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -113,13 +113,13 @@ QUnit.test(
const partnerId = pyEnv["res.partner"].create({ name: "name" + i });
channel_member_ids.push([0, 0, { partner_id: partnerId }]);
}
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "TestChanel",
channel_type: "channel",
});
const { openDiscuss } = await start();
await openDiscuss(channelId);
- pyEnv["mail.channel"].write([channelId], { channel_member_ids });
+ pyEnv["discuss.channel"].write([channelId], { channel_member_ids });
await click("button[title='Show Member List']");
assert.containsOnce($, "button:contains(Load more)");
}
@@ -133,13 +133,13 @@ QUnit.test("Load more button should load more members", async (assert) => {
const partnerId = pyEnv["res.partner"].create({ name: "name" + i });
channel_member_ids.push([0, 0, { partner_id: partnerId }]);
}
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "TestChanel",
channel_type: "channel",
});
const { openDiscuss } = await start();
await openDiscuss(channelId);
- pyEnv["mail.channel"].write([channelId], { channel_member_ids });
+ pyEnv["discuss.channel"].write([channelId], { channel_member_ids });
await click("button[title='Show Member List']");
await click("button[title='Load more']");
assert.containsN($, ".o-mail-ChannelMember", 102);
@@ -147,12 +147,12 @@ QUnit.test("Load more button should load more members", async (assert) => {
QUnit.test("Channel member count update after user joined", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const userId = pyEnv["res.users"].create({ name: "Harry" });
pyEnv["res.partner"].create({ name: "Harry", user_ids: [userId] });
const { env, openDiscuss } = await start();
await openDiscuss(channelId);
- const thread = env.services["mail.store"].threads[createLocalId("mail.channel", channelId)];
+ const thread = env.services["mail.store"].threads[createLocalId("discuss.channel", channelId)];
assert.strictEqual(thread.memberCount, 1);
await click("button[title='Show Member List']");
await click("button[title='Add Users']");
@@ -165,7 +165,7 @@ QUnit.test("Channel member count update after user left", async (assert) => {
const pyEnv = await startServer();
const userId = pyEnv["res.users"].create({ name: "Dobby" });
const partnerId = pyEnv["res.partner"].create({ name: "Dobby", user_ids: [userId] });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "General",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -174,9 +174,9 @@ QUnit.test("Channel member count update after user left", async (assert) => {
});
const { env, openDiscuss } = await start();
await openDiscuss(channelId);
- const thread = env.services["mail.store"].threads[createLocalId("mail.channel", channelId)];
+ const thread = env.services["mail.store"].threads[createLocalId("discuss.channel", channelId)];
assert.strictEqual(thread.memberCount, 2);
- await env.services.orm.call("mail.channel", "action_unfollow", [channelId], {
+ await env.services.orm.call("discuss.channel", "action_unfollow", [channelId], {
context: { mockedUserId: userId },
});
await nextTick();
diff --git a/addons/mail/static/tests/discuss/discuss_tests.js b/addons/mail/static/tests/discuss/discuss_tests.js
index b6a21ab1f34..8973b03eaeb 100644
--- a/addons/mail/static/tests/discuss/discuss_tests.js
+++ b/addons/mail/static/tests/discuss/discuss_tests.js
@@ -40,13 +40,13 @@ QUnit.test("sanity check", async (assert) => {
QUnit.test("can change the thread name of #general", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
const { openDiscuss } = await start({
mockRPC(route, params) {
- if (route === "/web/dataset/call_kw/mail.channel/channel_rename") {
+ if (route === "/web/dataset/call_kw/discuss.channel/channel_rename") {
assert.step(route);
}
},
@@ -62,19 +62,19 @@ QUnit.test("can change the thread name of #general", async (assert) => {
key: "Enter",
});
assert.strictEqual($name.val(), "special");
- assert.verifySteps(["/web/dataset/call_kw/mail.channel/channel_rename"]);
+ assert.verifySteps(["/web/dataset/call_kw/discuss.channel/channel_rename"]);
});
QUnit.test("can change the thread description of #general", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
description: "General announcements...",
});
const { openDiscuss } = await start({
mockRPC(route, params) {
- if (route === "/web/dataset/call_kw/mail.channel/channel_change_description") {
+ if (route === "/web/dataset/call_kw/discuss.channel/channel_change_description") {
assert.step(route);
}
},
@@ -94,7 +94,7 @@ QUnit.test("can change the thread description of #general", async (assert) => {
key: "Enter",
});
assert.strictEqual($description.val(), "I want a burger today!");
- assert.verifySteps(["/web/dataset/call_kw/mail.channel/channel_change_description"]);
+ assert.verifySteps(["/web/dataset/call_kw/discuss.channel/channel_change_description"]);
});
QUnit.test("can create a new channel [REQUIRE FOCUS]", async (assert) => {
@@ -103,9 +103,10 @@ QUnit.test("can create a new channel [REQUIRE FOCUS]", async (assert) => {
mockRPC(route, params) {
if (
route.startsWith("/mail") ||
+ route.startsWith("/discuss") ||
[
- "/web/dataset/call_kw/mail.channel/search_read",
- "/web/dataset/call_kw/mail.channel/channel_create",
+ "/web/dataset/call_kw/discuss.channel/search_read",
+ "/web/dataset/call_kw/discuss.channel/channel_create",
].includes(route)
) {
assert.step(route);
@@ -124,9 +125,9 @@ QUnit.test("can create a new channel [REQUIRE FOCUS]", async (assert) => {
"/mail/init_messaging",
"/mail/load_message_failures",
"/mail/inbox/messages",
- "/web/dataset/call_kw/mail.channel/search_read",
- "/web/dataset/call_kw/mail.channel/channel_create",
- "/mail/channel/messages",
+ "/web/dataset/call_kw/discuss.channel/search_read",
+ "/web/dataset/call_kw/discuss.channel/channel_create",
+ "/discuss/channel/messages",
]);
});
@@ -172,11 +173,12 @@ QUnit.test("can join a chat conversation", async (assert) => {
mockRPC(route, params) {
if (
route.startsWith("/mail") ||
- ["/web/dataset/call_kw/mail.channel/channel_get"].includes(route)
+ route.startsWith("/discuss") ||
+ ["/web/dataset/call_kw/discuss.channel/channel_get"].includes(route)
) {
assert.step(route);
}
- if (route === "/web/dataset/call_kw/mail.channel/channel_get") {
+ if (route === "/web/dataset/call_kw/discuss.channel/channel_get") {
assert.equal(params.kwargs.partners_to[0], partnerId);
}
},
@@ -196,8 +198,8 @@ QUnit.test("can join a chat conversation", async (assert) => {
"/mail/init_messaging",
"/mail/load_message_failures",
"/mail/inbox/messages",
- "/web/dataset/call_kw/mail.channel/channel_get",
- "/mail/channel/messages",
+ "/web/dataset/call_kw/discuss.channel/channel_get",
+ "/discuss/channel/messages",
]);
});
@@ -250,14 +252,14 @@ QUnit.test(
QUnit.test("Message following a notification should not be squashed", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: '',
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "notification",
});
@@ -270,7 +272,7 @@ QUnit.test("Message following a notification should not be squashed", async (ass
QUnit.test("Posting message should transform links.", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
@@ -283,7 +285,7 @@ QUnit.test("Posting message should transform links.", async (assert) => {
QUnit.test("Posting message should transform relevant data to emoji.", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
@@ -298,7 +300,7 @@ QUnit.test(
"posting a message immediately after another one is displayed in 'simple' mode (squashed)",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
@@ -346,7 +348,7 @@ QUnit.test("Click on avatar opens its partner chat window", async (assert) => {
QUnit.test("Can use channel command /who", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "my-channel",
});
@@ -364,7 +366,7 @@ QUnit.test("sidebar: chat im_status rendering", async (assert) => {
{ im_status: "online", name: "Partner2" },
{ im_status: "away", name: "Partner3" },
]);
- pyEnv["mail.channel"].create([
+ pyEnv["discuss.channel"].create([
{
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -403,7 +405,7 @@ QUnit.test("sidebar: chat im_status rendering", async (assert) => {
QUnit.test("No load more when fetch below fetch limit of 30", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const partnerId = pyEnv["res.partner"].create({});
pyEnv["res.partner"].create({});
for (let i = 28; i >= 0; i--) {
@@ -411,13 +413,13 @@ QUnit.test("No load more when fetch below fetch limit of 30", async (assert) =>
author_id: partnerId,
body: "not empty",
date: "2019-04-20 10:00:00",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
}
const { openDiscuss } = await start({
async mockRPC(route, args) {
- if (route === "/mail/channel/messages") {
+ if (route === "/discuss/channel/messages") {
assert.strictEqual(args.limit, 30);
}
},
@@ -429,7 +431,7 @@ QUnit.test("No load more when fetch below fetch limit of 30", async (assert) =>
QUnit.test("show date separator above mesages of similar date", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const partnerId = pyEnv["res.partner"].create({});
pyEnv["res.partner"].create({});
for (let i = 28; i >= 0; i--) {
@@ -437,7 +439,7 @@ QUnit.test("show date separator above mesages of similar date", async (assert) =
author_id: partnerId,
body: "not empty",
date: "2019-04-20 10:00:00",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
}
@@ -453,7 +455,7 @@ QUnit.test("show date separator above mesages of similar date", async (assert) =
QUnit.test("sidebar: chat custom name", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Marc Demo" });
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { custom_channel_name: "Marc", partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: partnerId }],
@@ -519,10 +521,10 @@ QUnit.test("reply to message from inbox (message linked to document)", async (as
QUnit.test("Can reply to starred message", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "RandomName" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "RandomName" });
pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
starred_partner_ids: [pyEnv.currentPartnerId],
res_id: channelId,
});
@@ -542,10 +544,10 @@ QUnit.test("Can reply to starred message", async (assert) => {
QUnit.test("Can reply to history message", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "RandomName" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "RandomName" });
const messageId = pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
history_partner_ids: [pyEnv.currentPartnerId],
res_id: channelId,
});
@@ -671,7 +673,7 @@ QUnit.test("sidebar: add channel", async (assert) => {
QUnit.test("sidebar: basic channel rendering", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "General" });
+ pyEnv["discuss.channel"].create({ name: "General" });
const { openDiscuss } = await start();
await openDiscuss();
assert.containsOnce($, ".o-mail-DiscussCategoryItem");
@@ -694,7 +696,7 @@ QUnit.test("sidebar: basic channel rendering", async (assert) => {
QUnit.test("channel become active", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "General" });
+ pyEnv["discuss.channel"].create({ name: "General" });
const { openDiscuss } = await start();
await openDiscuss();
assert.containsOnce($, ".o-mail-DiscussCategoryItem");
@@ -705,7 +707,7 @@ QUnit.test("channel become active", async (assert) => {
QUnit.test("channel become active - show composer in discuss content", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "General" });
+ pyEnv["discuss.channel"].create({ name: "General" });
const { openDiscuss } = await start();
await openDiscuss();
await click(".o-mail-DiscussCategoryItem");
@@ -715,10 +717,10 @@ QUnit.test("channel become active - show composer in discuss content", async (as
QUnit.test("sidebar: channel rendering with needaction counter", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const messageId = pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
pyEnv["mail.notification"].create({
@@ -734,7 +736,7 @@ QUnit.test("sidebar: channel rendering with needaction counter", async (assert)
QUnit.test("sidebar: chat rendering with unread counter", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { message_unread_counter: 100, partner_id: pyEnv.currentPartnerId }],
],
@@ -753,13 +755,13 @@ QUnit.test("initially load messages from inbox", async (assert) => {
const { openDiscuss } = await start({
async mockRPC(route, args) {
if (route === "/mail/inbox/messages") {
- assert.step("/mail/channel/messages");
+ assert.step("/discuss/channel/messages");
assert.strictEqual(args.limit, 30);
}
},
});
await openDiscuss();
- assert.verifySteps(["/mail/channel/messages"]);
+ assert.verifySteps(["/discuss/channel/messages"]);
});
QUnit.test("default active id on mailbox", async (assert) => {
@@ -770,7 +772,7 @@ QUnit.test("default active id on mailbox", async (assert) => {
QUnit.test("basic top bar rendering", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "General" });
+ pyEnv["discuss.channel"].create({ name: "General" });
const { openDiscuss } = await start();
await openDiscuss();
assert.strictEqual($(".o-mail-Discuss-threadName").val(), "Inbox");
@@ -826,17 +828,17 @@ QUnit.test("rendering of inbox message", async (assert) => {
QUnit.test('messages marked as read move to "History" mailbox', async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "other-disco" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "other-disco" });
const [messageId_1, messageId_2] = pyEnv["mail.message"].create([
{
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
needaction: true,
res_id: channelId,
},
{
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
needaction: true,
res_id: channelId,
},
@@ -947,12 +949,12 @@ QUnit.test('all messages in "Inbox" in "History" after marked all as read', asyn
QUnit.test("post a simple message", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const { openDiscuss } = await start({
async mockRPC(route, args) {
if (route === "/mail/message/post") {
assert.step("message_post");
- assert.strictEqual(args.thread_model, "mail.channel");
+ assert.strictEqual(args.thread_model, "discuss.channel");
assert.strictEqual(args.thread_id, channelId);
assert.strictEqual(args.post_data.body, "Test");
assert.strictEqual(args.post_data.message_type, "comment");
@@ -1003,7 +1005,7 @@ QUnit.test("starred: unstar all", async (assert) => {
QUnit.test("auto-focus composer on opening thread", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo User" });
- pyEnv["mail.channel"].create([
+ pyEnv["discuss.channel"].create([
{ name: "General" },
{
channel_member_ids: [
@@ -1038,7 +1040,7 @@ QUnit.test(
"receive new chat message: out of odoo focus (notification, channel)",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ channel_type: "chat" });
+ const channelId = pyEnv["discuss.channel"].create({ channel_type: "chat" });
const { env, openDiscuss } = await start({
services: {
presence: makeFakePresenceService({ isOdooFocused: () => false }),
@@ -1050,13 +1052,13 @@ QUnit.test(
assert.strictEqual(payload.part, "_chat");
assert.strictEqual(payload.title, "1 Message");
});
- const channel = pyEnv["mail.channel"].searchRead([["id", "=", channelId]])[0];
+ const channel = pyEnv["discuss.channel"].searchRead([["id", "=", channelId]])[0];
// simulate receiving a new message with odoo focused
- pyEnv["bus.bus"]._sendone(channel, "mail.channel/new_message", {
+ pyEnv["bus.bus"]._sendone(channel, "discuss.channel/new_message", {
id: channelId,
message: {
id: 126,
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
});
@@ -1067,7 +1069,7 @@ QUnit.test(
QUnit.test("receive new chat message: out of odoo focus (notification, chat)", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ channel_type: "chat" });
+ const channelId = pyEnv["discuss.channel"].create({ channel_type: "chat" });
const { env, openDiscuss } = await start({
services: {
presence: makeFakePresenceService({ isOdooFocused: () => false }),
@@ -1079,13 +1081,13 @@ QUnit.test("receive new chat message: out of odoo focus (notification, chat)", a
assert.strictEqual(payload.part, "_chat");
assert.strictEqual(payload.title, "1 Message");
});
- const channel = pyEnv["mail.channel"].searchRead([["id", "=", channelId]])[0];
+ const channel = pyEnv["discuss.channel"].searchRead([["id", "=", channelId]])[0];
// simulate receiving a new message with odoo focused
- pyEnv["bus.bus"]._sendone(channel, "mail.channel/new_message", {
+ pyEnv["bus.bus"]._sendone(channel, "discuss.channel/new_message", {
id: channelId,
message: {
id: 126,
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
});
@@ -1096,7 +1098,7 @@ QUnit.test("receive new chat message: out of odoo focus (notification, chat)", a
QUnit.test("receive new chat messages: out of odoo focus (tab title)", async (assert) => {
let step = 0;
const pyEnv = await startServer();
- const [channelId_1, channelId_2] = pyEnv["mail.channel"].create([
+ const [channelId_1, channelId_2] = pyEnv["discuss.channel"].create([
{ channel_type: "chat" },
{ channel_type: "chat" },
]);
@@ -1120,26 +1122,26 @@ QUnit.test("receive new chat messages: out of odoo focus (tab title)", async (as
assert.strictEqual(payload.title, "3 Messages");
}
});
- const channel_1 = pyEnv["mail.channel"].searchRead([["id", "=", channelId_1]])[0];
+ const channel_1 = pyEnv["discuss.channel"].searchRead([["id", "=", channelId_1]])[0];
// simulate receiving a new message in chat 1 with odoo focused
- pyEnv["bus.bus"]._sendone(channel_1, "mail.channel/new_message", {
+ pyEnv["bus.bus"]._sendone(channel_1, "discuss.channel/new_message", {
id: channelId_1,
message: {
id: 126,
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_1,
},
});
await nextTick();
assert.verifySteps(["set_title_part"]);
- const channel_2 = pyEnv["mail.channel"].searchRead([["id", "=", channelId_2]])[0];
+ const channel_2 = pyEnv["discuss.channel"].searchRead([["id", "=", channelId_2]])[0];
// simulate receiving a new message in chat 2 with odoo focused
- pyEnv["bus.bus"]._sendone(channel_2, "mail.channel/new_message", {
+ pyEnv["bus.bus"]._sendone(channel_2, "discuss.channel/new_message", {
id: channelId_2,
message: {
id: 127,
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_2,
},
});
@@ -1147,11 +1149,11 @@ QUnit.test("receive new chat messages: out of odoo focus (tab title)", async (as
assert.verifySteps(["set_title_part"]);
// simulate receiving another new message in chat 2 with odoo focused
- pyEnv["bus.bus"]._sendone(channel_2, "mail.channel/new_message", {
+ pyEnv["bus.bus"]._sendone(channel_2, "discuss.channel/new_message", {
id: channelId_2,
message: {
id: 128,
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_2,
},
});
@@ -1164,7 +1166,7 @@ QUnit.test("should auto-pin chat when receiving a new DM", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
const userId = pyEnv["res.users"].create({ partner_id: partnerId });
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { is_pinned: false, partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: partnerId }],
@@ -1189,7 +1191,7 @@ QUnit.test("should auto-pin chat when receiving a new DM", async (assert) => {
QUnit.test("'Add Users' button should be displayed in the topbar of channels", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
@@ -1201,7 +1203,7 @@ QUnit.test("'Add Users' button should be displayed in the topbar of channels", a
QUnit.test("'Add Users' button should be displayed in the topbar of chats", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Marc Demo" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: partnerId }],
@@ -1216,7 +1218,7 @@ QUnit.test("'Add Users' button should be displayed in the topbar of chats", asyn
QUnit.test("'Add Users' button should be displayed in the topbar of groups", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: partnerId }],
@@ -1242,7 +1244,7 @@ QUnit.test(
async (assert) => {
const pyEnv = await startServer();
const groupId = pyEnv["res.groups"].create({ name: "testGroup" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "string",
group_public_id: groupId,
@@ -1257,7 +1259,7 @@ QUnit.test(
"'Globe' thread icon is displayed in top bar of channels of type 'channel' not limited to any group",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "string",
group_public_id: false,
@@ -1278,7 +1280,7 @@ QUnit.test(
{ im_status: "away", name: "Nabuchodonosor Away" },
{ im_status: "im_partner", name: "Robert Fired" },
]);
- pyEnv["mail.channel"].create([
+ pyEnv["discuss.channel"].create([
{
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -1337,7 +1339,7 @@ QUnit.test(
"'Users' thread icon is displayed in top bar of channels of type 'group'",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ channel_type: "group" });
+ const channelId = pyEnv["discuss.channel"].create({ channel_type: "group" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
assert.containsOnce($, ".o-mail-Discuss-header .fa-users[title='Grouped Chat']");
@@ -1346,7 +1348,7 @@ QUnit.test(
QUnit.test("Do not trigger chat name server update when it is unchanged", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ channel_type: "chat" });
+ const channelId = pyEnv["discuss.channel"].create({ channel_type: "chat" });
const { openDiscuss } = await start({
mockRPC(route, args, originalRPC) {
if (args.method === "channel_set_custom_name") {
@@ -1367,7 +1369,7 @@ QUnit.test(
"Do not trigger channel description server update when channel has no description and editing to empty description",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const { openDiscuss } = await start({
mockRPC(route, args, originalRPC) {
if (args.method === "channel_change_description") {
@@ -1387,7 +1389,7 @@ QUnit.test(
QUnit.test("Channel is added to discuss after invitation", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "General",
channel_member_ids: [],
});
@@ -1400,7 +1402,7 @@ QUnit.test("Channel is added to discuss after invitation", async (assert) => {
await openDiscuss();
assert.containsNone($, ".o-mail-DiscussCategoryItem:contains(General)");
await afterNextRender(() => {
- env.services.orm.call("mail.channel", "add_members", [[channelId]], {
+ env.services.orm.call("discuss.channel", "add_members", [[channelId]], {
partner_ids: [pyEnv.currentPartnerId],
context: { mockedUserId: userId },
});
@@ -1454,7 +1456,7 @@ QUnit.test(
"composer should be focused automatically after clicking on the send button [REQUIRE FOCUS]",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "test" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "test" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await insertText(".o-mail-Composer-input", "Dummy Message");
@@ -1467,7 +1469,7 @@ QUnit.test(
"mark channel as seen if last message is visible when switching channels when the previous channel had a more recent last message than the current channel [REQUIRE FOCUS]",
async (assert) => {
const pyEnv = await startServer();
- const [channelId_1, channelId_2] = pyEnv["mail.channel"].create([
+ const [channelId_1, channelId_2] = pyEnv["discuss.channel"].create([
{
channel_member_ids: [
[
@@ -1498,12 +1500,12 @@ QUnit.test(
pyEnv["mail.message"].create([
{
body: "oldest message",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_1,
},
{
body: "newest message",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_2,
},
]);
@@ -1518,7 +1520,7 @@ QUnit.test(
"warning on send with shortcut when attempting to post message with still-uploading attachments",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "test" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "test" });
const { openDiscuss } = await start({
async mockRPC(route) {
if (route === "/mail/attachment/upload") {
@@ -1563,20 +1565,20 @@ QUnit.test("new messages separator [REQUIRE FOCUS]", async (assert) => {
name: "Foreigner user",
partner_id: partnerId,
});
- const channelId = pyEnv["mail.channel"].create({ name: "test", uuid: "randomuuid" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "test", uuid: "randomuuid" });
let lastMessageId;
for (let i = 1; i <= 25; i++) {
lastMessageId = pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
}
- const [memberId] = pyEnv["mail.channel.member"].search([
+ const [memberId] = pyEnv["discuss.channel.member"].search([
["channel_id", "=", channelId],
["partner_id", "=", pyEnv.currentPartnerId],
]);
- pyEnv["mail.channel.member"].write([memberId], { seen_message_id: lastMessageId });
+ pyEnv["discuss.channel.member"].write([memberId], { seen_message_id: lastMessageId });
const { env, openDiscuss } = await start();
await openDiscuss(channelId);
assert.containsN($, ".o-mail-Message", 25);
@@ -1605,13 +1607,13 @@ QUnit.test("new messages separator [REQUIRE FOCUS]", async (assert) => {
QUnit.test("failure on loading messages should display error", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "General",
});
const { openDiscuss } = await start({
async mockRPC(route, args) {
- if (route === "/mail/channel/messages") {
+ if (route === "/discuss/channel/messages") {
return Promise.reject();
}
},
@@ -1625,13 +1627,13 @@ QUnit.test("failure on loading messages should display error", async (assert) =>
QUnit.test("failure on loading messages should prompt retry button", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "General",
});
const { openDiscuss } = await start({
async mockRPC(route, args) {
- if (route === "/mail/channel/messages") {
+ if (route === "/discuss/channel/messages") {
return Promise.reject();
}
},
@@ -1648,7 +1650,7 @@ QUnit.test(
// any later call should work so that retry button and load more clicks would now work
let messageFetchShouldFail = false;
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "General",
});
@@ -1656,14 +1658,14 @@ QUnit.test(
[...Array(60).keys()].map(() => {
return {
body: "coucou",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
};
})
);
const { openDiscuss } = await start({
async mockRPC(route, args) {
- if (route === "/mail/channel/messages" && messageFetchShouldFail) {
+ if (route === "/discuss/channel/messages" && messageFetchShouldFail) {
return Promise.reject();
}
},
@@ -1683,7 +1685,7 @@ QUnit.test(
// any later call should work so that retry button and load more clicks would now work
let messageFetchShouldFail = false;
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "General",
});
@@ -1691,14 +1693,14 @@ QUnit.test(
[...Array(60).keys()].map(() => {
return {
body: "coucou",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
};
})
);
const { openDiscuss } = await start({
async mockRPC(route, args) {
- if (route === "/mail/channel/messages" && messageFetchShouldFail) {
+ if (route === "/discuss/channel/messages" && messageFetchShouldFail) {
return Promise.reject();
}
},
@@ -1723,7 +1725,7 @@ QUnit.test(
// any later call should work so that retry button and load more clicks would now work
let messageFetchShouldFail = false;
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "General",
});
@@ -1731,14 +1733,14 @@ QUnit.test(
[...Array(90).keys()].map(() => {
return {
body: "coucou",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
};
})
);
const { openDiscuss } = await start({
async mockRPC(route, args) {
- if (route === "/mail/channel/messages") {
+ if (route === "/discuss/channel/messages") {
if (messageFetchShouldFail) {
return Promise.reject();
}
@@ -1756,7 +1758,7 @@ QUnit.test(
QUnit.test("composer state: attachments save and restore", async (assert) => {
const pyEnv = await startServer();
- const [channelId] = pyEnv["mail.channel"].create([{ name: "General" }, { name: "Special" }]);
+ const [channelId] = pyEnv["discuss.channel"].create([{ name: "General" }, { name: "Special" }]);
const { openDiscuss } = await start();
await openDiscuss(channelId);
// Add attachment in a message for #general
@@ -1809,7 +1811,7 @@ QUnit.test(
"sidebar: cannot unpin channel group_based_subscription: mandatorily pinned",
async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
name: "General",
channel_member_ids: [[0, 0, { is_pinned: false, partner_id: pyEnv.currentPartnerId }]],
group_based_subscription: true,
@@ -1823,21 +1825,21 @@ QUnit.test(
QUnit.test("restore thread scroll position", async (assert) => {
const pyEnv = await startServer();
- const [channelId_1, channelId_2] = pyEnv["mail.channel"].create([
+ const [channelId_1, channelId_2] = pyEnv["discuss.channel"].create([
{ name: "Channel1" },
{ name: "Channel2" },
]);
for (let i = 1; i <= 25; i++) {
pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_1,
});
}
for (let i = 1; i <= 24; i++) {
pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_2,
});
}
@@ -1873,7 +1875,7 @@ QUnit.test("Message shows up even if channel data is incomplete", async (assert)
name: "Albert",
user_ids: [correspondentUserId],
});
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[
0,
@@ -1887,12 +1889,12 @@ QUnit.test("Message shows up even if channel data is incomplete", async (assert)
],
channel_type: "chat",
});
- await env.services.rpc("/mail/channel/notify_typing", {
+ await env.services.rpc("/discuss/channel/notify_typing", {
context: { mockedPartnerId: correspondentPartnerId },
is_typing: true,
channel_id: channelId,
});
- const [channel] = pyEnv["mail.channel"].searchRead([["id", "=", channelId]]);
+ const [channel] = pyEnv["discuss.channel"].searchRead([["id", "=", channelId]]);
await afterNextRender(
async () =>
await env.services.rpc("/mail/chat_post", {
@@ -1907,7 +1909,7 @@ QUnit.test("Message shows up even if channel data is incomplete", async (assert)
QUnit.test("Create a direct message channel when clicking on start a meeting", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "General",
});
@@ -1920,7 +1922,7 @@ QUnit.test("Create a direct message channel when clicking on start a meeting", a
QUnit.test("Member list and settings menu are exclusive", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await click("button[title='Show Member List']");
@@ -1934,7 +1936,7 @@ QUnit.test(
"Correct breadcrumb when open discuss from chat window then see settings",
async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "General" });
+ pyEnv["discuss.channel"].create({ name: "General" });
await start();
await click(".o_main_navbar i[aria-label='Messages']");
await click(".o-mail-NotificationItem:contains(General)");
diff --git a/addons/mail/static/tests/discuss/im_status_tests.js b/addons/mail/static/tests/discuss/im_status_tests.js
index 169204afaa5..513af2f14b3 100644
--- a/addons/mail/static/tests/discuss/im_status_tests.js
+++ b/addons/mail/static/tests/discuss/im_status_tests.js
@@ -10,11 +10,11 @@ QUnit.module("im status");
QUnit.test("initially online", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ im_status: "online" });
- const channelId = pyEnv["mail.channel"].create({ name: "TestChanel" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "TestChanel" });
pyEnv["mail.message"].create({
author_id: partnerId,
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { advanceTime, openDiscuss } = await start({ hasTimeControl: true });
@@ -26,11 +26,11 @@ QUnit.test("initially online", async (assert) => {
QUnit.test("initially offline", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ im_status: "offline" });
- const channelId = pyEnv["mail.channel"].create({ name: "TestChannel" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "TestChannel" });
pyEnv["mail.message"].create({
author_id: partnerId,
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { advanceTime, openDiscuss } = await start({ hasTimeControl: true });
@@ -42,11 +42,11 @@ QUnit.test("initially offline", async (assert) => {
QUnit.test("initially away", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ im_status: "away" });
- const channelId = pyEnv["mail.channel"].create({ name: "TestChanel" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "TestChanel" });
pyEnv["mail.message"].create({
author_id: partnerId,
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { advanceTime, openDiscuss } = await start({ hasTimeControl: true });
@@ -58,11 +58,11 @@ QUnit.test("initially away", async (assert) => {
QUnit.test("change icon on change partner im_status", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ im_status: "online" });
- const channelId = pyEnv["mail.channel"].create({ name: "TestChannel" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "TestChannel" });
pyEnv["mail.message"].create({
author_id: partnerId,
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { advanceTime, openDiscuss } = await start({ hasTimeControl: true });
@@ -98,7 +98,7 @@ QUnit.test("Can handle im_status of unknown partner", async (assert) => {
QUnit.test("show im status in messaging menu preview of chat", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo", im_status: "online" });
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: partnerId }],
diff --git a/addons/mail/static/tests/discuss/inbox_tests.js b/addons/mail/static/tests/discuss/inbox_tests.js
index 1f1d9ade656..fa992515f40 100644
--- a/addons/mail/static/tests/discuss/inbox_tests.js
+++ b/addons/mail/static/tests/discuss/inbox_tests.js
@@ -204,7 +204,7 @@ QUnit.test("show subject of message in Inbox", async (assert) => {
const pyEnv = await startServer();
const messageId = pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
needaction: true,
needaction_partner_ids: [pyEnv.currentPartnerId], // not needed, for consistency
subject: "Salutations, voyageur",
@@ -226,7 +226,7 @@ QUnit.test("show subject of message in history", async (assert) => {
const messageId = pyEnv["mail.message"].create({
body: "not empty",
history_partner_ids: [3], // not needed, for consistency
- model: "mail.channel",
+ model: "discuss.channel",
subject: "Salutations, voyageur",
});
pyEnv["mail.notification"].create({
@@ -246,10 +246,10 @@ QUnit.test(
"subject should not be shown when subject is the same as the thread name",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "Salutations, voyageur" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "Salutations, voyageur" });
const messageId = pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
needaction: true,
subject: "Salutations, voyageur",
@@ -270,10 +270,10 @@ QUnit.test(
"subject should not be shown when subject is the same as the thread name and both have the same prefix",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "Re: Salutations, voyageur" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "Re: Salutations, voyageur" });
const messageId = pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
needaction: true,
subject: "Re: Salutations, voyageur",
@@ -294,10 +294,10 @@ QUnit.test(
'subject should not be shown when subject differs from thread name only by the "Re:" prefix',
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "Salutations, voyageur" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "Salutations, voyageur" });
const messageId = pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
needaction: true,
subject: "Re: Salutations, voyageur",
@@ -318,10 +318,10 @@ QUnit.test(
'subject should not be shown when subject differs from thread name only by the "Fw:" and "Re:" prefix',
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "Salutations, voyageur" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "Salutations, voyageur" });
const messageId = pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
needaction: true,
subject: "Fw: Re: Salutations, voyageur",
@@ -342,10 +342,10 @@ QUnit.test(
"subject should be shown when the thread name has an extra prefix compared to subject",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "Re: Salutations, voyageur" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "Re: Salutations, voyageur" });
const messageId = pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
needaction: true,
subject: "Salutations, voyageur",
@@ -366,10 +366,10 @@ QUnit.test(
'subject should not be shown when subject differs from thread name only by the "fw:" prefix and both contain another common prefix',
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "Re: Salutations, voyageur" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "Re: Salutations, voyageur" });
const messageId = pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
needaction: true,
subject: "fw: re: Salutations, voyageur",
@@ -390,10 +390,10 @@ QUnit.test(
'subject should not be shown when subject differs from thread name only by the "Re: Re:" prefix',
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "Salutations, voyageur" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "Salutations, voyageur" });
const messageId = pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
needaction: true,
subject: "Re: Re: Salutations, voyageur",
@@ -412,17 +412,17 @@ QUnit.test(
QUnit.test("inbox: mark all messages as read", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const [messageId_1, messageId_2] = pyEnv["mail.message"].create([
{
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
needaction: true,
res_id: channelId,
},
{
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
needaction: true,
res_id: channelId,
},
@@ -497,14 +497,14 @@ QUnit.test(
QUnit.test("inbox messages are never squashed", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({});
- const channelId = pyEnv["mail.channel"].create({ name: "test" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "test" });
const [messageId_1, messageId_2] = pyEnv["mail.message"].create([
{
author_id: partnerId,
body: "body1
",
date: "2019-04-20 10:00:00",
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
needaction: true,
needaction_partner_ids: [pyEnv.currentPartnerId],
res_id: channelId,
@@ -514,7 +514,7 @@ QUnit.test("inbox messages are never squashed", async (assert) => {
body: "body2
",
date: "2019-04-20 10:00:30",
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
needaction: true,
needaction_partner_ids: [pyEnv.currentPartnerId],
res_id: channelId,
@@ -596,11 +596,11 @@ QUnit.test("error notifications should not be shown in Inbox", async (assert) =>
QUnit.test("emptying inbox displays rainbow man in inbox", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const messageId1 = pyEnv["mail.message"].create([
{
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
needaction: true,
res_id: channelId,
},
@@ -620,7 +620,7 @@ QUnit.test("emptying inbox displays rainbow man in inbox", async (assert) => {
QUnit.test("emptying inbox doesn't display rainbow man in another thread", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const partnerId = pyEnv["res.partner"].create({});
const messageId = pyEnv["mail.message"].create({
body: "not empty",
diff --git a/addons/mail/static/tests/discuss/jump_to_present_tests.js b/addons/mail/static/tests/discuss/jump_to_present_tests.js
index f4fe5a93cc5..caa908fe002 100644
--- a/addons/mail/static/tests/discuss/jump_to_present_tests.js
+++ b/addons/mail/static/tests/discuss/jump_to_present_tests.js
@@ -20,17 +20,17 @@ QUnit.test("Basic jump to present when scrolling to outdated messages", async (a
},
});
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
pyEnv["mail.message"].create({
body: "Hello world!",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
for (let i = 0; i < 20; i++) {
pyEnv["mail.message"].create({
body: "Non Empty Body ".repeat(100),
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
}
@@ -59,23 +59,23 @@ QUnit.test("Jump to old reply should prompt jump to presence", async (assert) =>
},
});
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const oldestMessageId = pyEnv["mail.message"].create({
body: "Hello world!",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
for (let i = 0; i < 100; i++) {
pyEnv["mail.message"].create({
body: "Non Empty Body ".repeat(100),
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
}
pyEnv["mail.message"].create({
body: "Most Recent!",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
parent_id: oldestMessageId,
});
diff --git a/addons/mail/static/tests/discuss/pinned_messages_tests.js b/addons/mail/static/tests/discuss/pinned_messages_tests.js
index cafdfbbab01..7d5dae9382b 100644
--- a/addons/mail/static/tests/discuss/pinned_messages_tests.js
+++ b/addons/mail/static/tests/discuss/pinned_messages_tests.js
@@ -7,10 +7,10 @@ QUnit.module("pinned messages");
QUnit.test("Pin message", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
pyEnv["mail.message"].create({
body: "Hello world!",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -28,10 +28,10 @@ QUnit.test("Pin message", async (assert) => {
QUnit.test("Unpin message", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
pyEnv["mail.message"].create({
body: "Hello world!",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
pinned_at: "2023-03-30 11:27:11",
});
@@ -47,11 +47,11 @@ QUnit.test("Unpin message", async (assert) => {
QUnit.test("Deleted messages are not pinned", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
pyEnv["mail.message"].create({
body: "Hello world!",
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
pinned_at: "2023-03-30 11:27:11",
});
@@ -67,10 +67,10 @@ QUnit.test("Deleted messages are not pinned", async (assert) => {
QUnit.test("Open pinned panel from notification", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
pyEnv["mail.message"].create({
body: "Hello world!",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -91,10 +91,10 @@ QUnit.test("Jump to message", async (assert) => {
},
});
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
pyEnv["mail.message"].create({
body: "Hello world!",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
pinned_at: "2023-04-03 08:15:04",
});
@@ -102,7 +102,7 @@ QUnit.test("Jump to message", async (assert) => {
pyEnv["mail.message"].create({
body: "Non Empty Body ".repeat(25),
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
}
@@ -122,17 +122,17 @@ QUnit.test("Jump to message from notification", async (assert) => {
},
});
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
pyEnv["mail.message"].create({
body: "Hello world!",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
for (let i = 0; i < 20; i++) {
pyEnv["mail.message"].create({
body: "Non Empty Body ".repeat(25),
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
}
diff --git a/addons/mail/static/tests/discuss/sidebar_tests.js b/addons/mail/static/tests/discuss/sidebar_tests.js
index b8615ed53af..53e774442ea 100644
--- a/addons/mail/static/tests/discuss/sidebar_tests.js
+++ b/addons/mail/static/tests/discuss/sidebar_tests.js
@@ -16,7 +16,7 @@ QUnit.module("discuss sidebar");
QUnit.test("toggling category button hide category items", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
@@ -31,7 +31,7 @@ QUnit.test("toggling category button hide category items", async (assert) => {
QUnit.test("toggling category button does not hide active category items", async (assert) => {
const pyEnv = await startServer();
- const [channelId] = pyEnv["mail.channel"].create([
+ const [channelId] = pyEnv["discuss.channel"].create([
{ name: "abc", channel_type: "channel" },
{ name: "def", channel_type: "channel" },
]);
@@ -133,7 +133,7 @@ QUnit.test(
QUnit.test("channel - states: close manually by clicking the title", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "general" });
+ pyEnv["discuss.channel"].create({ name: "general" });
pyEnv["res.users.settings"].create({
user_id: pyEnv.currentUserId,
is_discuss_sidebar_category_channel_open: true,
@@ -147,7 +147,7 @@ QUnit.test("channel - states: close manually by clicking the title", async (asse
QUnit.test("channel - states: open manually by clicking the title", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "general" });
+ pyEnv["discuss.channel"].create({ name: "general" });
pyEnv["res.users.settings"].create({
user_id: pyEnv.currentUserId,
is_discuss_sidebar_category_channel_open: false,
@@ -172,7 +172,7 @@ QUnit.test("sidebar: inbox with counter", async (assert) => {
QUnit.test("default thread rendering", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "General" });
+ pyEnv["discuss.channel"].create({ name: "General" });
const { openDiscuss } = await start();
await openDiscuss();
assert.containsOnce($, "button:contains(Inbox)");
@@ -207,7 +207,7 @@ QUnit.test("default thread rendering", async (assert) => {
QUnit.test("sidebar quick search at 20 or more pinned channels", async (assert) => {
const pyEnv = await startServer();
for (let id = 1; id <= 20; id++) {
- pyEnv["mail.channel"].create({ name: `channel${id}` });
+ pyEnv["discuss.channel"].create({ name: `channel${id}` });
}
const { openDiscuss } = await start();
await openDiscuss();
@@ -240,7 +240,7 @@ QUnit.test("sidebar quick search at 20 or more pinned channels", async (assert)
QUnit.test("sidebar: basic chat rendering", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: partnerId }],
@@ -263,7 +263,7 @@ QUnit.test("sidebar: basic chat rendering", async (assert) => {
QUnit.test("sidebar: show pinned channel", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "General" });
+ pyEnv["discuss.channel"].create({ name: "General" });
const { openDiscuss } = await start();
await openDiscuss();
assert.containsOnce($, ".o-mail-DiscussCategoryItem:contains(General)");
@@ -271,7 +271,7 @@ QUnit.test("sidebar: show pinned channel", async (assert) => {
QUnit.test("sidebar: open pinned channel", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "General" });
+ pyEnv["discuss.channel"].create({ name: "General" });
const { openDiscuss } = await start();
await openDiscuss();
await click(".o-mail-DiscussCategoryItem:contains(General)");
@@ -281,7 +281,7 @@ QUnit.test("sidebar: open pinned channel", async (assert) => {
QUnit.test("sidebar: open channel and leave it", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "General",
channel_member_ids: [
[0, 0, { fold_state: "open", is_minimized: true, partner_id: pyEnv.currentPartnerId }],
@@ -307,7 +307,7 @@ QUnit.test("sidebar: open channel and leave it", async (assert) => {
QUnit.test("sidebar: unpin channel from bus", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const { openDiscuss } = await start();
await openDiscuss();
assert.containsOnce($, ".o-mail-DiscussCategoryItem:contains(General)");
@@ -318,7 +318,7 @@ QUnit.test("sidebar: unpin channel from bus", async (assert) => {
// Simulate receiving a leave channel notification
// (e.g. from user interaction from another device or browser tab)
await afterNextRender(() => {
- pyEnv["bus.bus"]._sendone(pyEnv.currentPartner, "mail.channel/unpin", { id: channelId });
+ pyEnv["bus.bus"]._sendone(pyEnv.currentPartner, "discuss.channel/unpin", { id: channelId });
});
assert.containsNone($, ".o-mail-DiscussCategoryItem:contains(General)");
assert.notOk($(".o-mail-Discuss-threadName")?.val() === "General");
@@ -330,7 +330,7 @@ QUnit.test("chat - channel should count unread message [REQUIRE FOCUS]", async (
name: "Demo",
im_status: "offline",
});
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { message_unread_counter: 1, partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: partnerId }],
@@ -340,7 +340,7 @@ QUnit.test("chat - channel should count unread message [REQUIRE FOCUS]", async (
pyEnv["mail.message"].create({
author_id: partnerId,
body: "Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -354,7 +354,7 @@ QUnit.test("chat - channel should count unread message [REQUIRE FOCUS]", async (
QUnit.test("mark channel as seen on last message visible [REQUIRE FOCUS]", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
channel_member_ids: [
[0, 0, { message_unread_counter: 1, partner_id: pyEnv.currentPartnerId }],
@@ -362,7 +362,7 @@ QUnit.test("mark channel as seen on last message visible [REQUIRE FOCUS]", async
});
pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -382,7 +382,7 @@ QUnit.test(
user_id: pyEnv.currentUserId,
is_discuss_sidebar_category_channel_open: true,
});
- pyEnv["mail.channel"].create({ name: "general" });
+ pyEnv["discuss.channel"].create({ name: "general" });
const { openDiscuss } = await start();
await openDiscuss();
assert.containsNone($, ".o-mail-DiscussCategory:contains(Channels) .badge");
@@ -397,19 +397,19 @@ QUnit.test(
user_id: pyEnv.currentUserId,
is_discuss_sidebar_category_channel_open: true,
});
- const [channelId_1, channelId_2] = pyEnv["mail.channel"].create([
+ const [channelId_1, channelId_2] = pyEnv["discuss.channel"].create([
{ name: "channel1" },
{ name: "channel2" },
]);
const [messageId_1, messageId_2] = pyEnv["mail.message"].create([
{
body: "message 1",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_1,
},
{
body: "message_2",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_2,
},
]);
@@ -435,7 +435,7 @@ QUnit.test(
"channel - counter: should not have a counter if category is folded and without needaction messages",
async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({});
+ pyEnv["discuss.channel"].create({});
pyEnv["res.users.settings"].create({
user_id: pyEnv.currentUserId,
is_discuss_sidebar_category_channel_open: false,
@@ -450,19 +450,19 @@ QUnit.test(
"channel - counter: should have correct value of needaction threads if category is folded and with needaction messages",
async (assert) => {
const pyEnv = await startServer();
- const [channelId_1, channelId_2] = pyEnv["mail.channel"].create([
+ const [channelId_1, channelId_2] = pyEnv["discuss.channel"].create([
{ name: "Channel_1" },
{ name: "Channel_2" },
]);
const [messageId_1, messageId_2] = pyEnv["mail.message"].create([
{
body: "message 1",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_1,
},
{
body: "message_2",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_2,
},
]);
@@ -496,7 +496,7 @@ QUnit.test(
user_id: pyEnv.currentUserId,
is_discuss_sidebar_category_chat_open: true,
});
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { message_unread_counter: 0, partner_id: pyEnv.currentPartnerId }],
],
@@ -516,7 +516,7 @@ QUnit.test(
user_id: pyEnv.currentUserId,
is_discuss_sidebar_category_chat_open: true,
});
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { message_unread_counter: 10, partner_id: pyEnv.currentPartnerId }],
],
@@ -536,7 +536,7 @@ QUnit.test(
user_id: pyEnv.currentUserId,
is_discuss_sidebar_category_chat_open: false,
});
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { message_unread_counter: 0, partner_id: pyEnv.currentPartnerId }],
],
@@ -556,7 +556,7 @@ QUnit.test(
user_id: pyEnv.currentUserId,
is_discuss_sidebar_category_chat_open: false,
});
- pyEnv["mail.channel"].create([
+ pyEnv["discuss.channel"].create([
{
channel_member_ids: [
[0, 0, { message_unread_counter: 10, partner_id: pyEnv.currentPartnerId }],
@@ -607,7 +607,7 @@ QUnit.test(
QUnit.test("chat - states: close manually by clicking the title", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ channel_type: "chat" });
+ pyEnv["discuss.channel"].create({ channel_type: "chat" });
pyEnv["res.users.settings"].create({
user_id: pyEnv.currentUserId,
is_discuss_sidebar_category_chat_open: true,
@@ -621,7 +621,7 @@ QUnit.test("chat - states: close manually by clicking the title", async (assert)
QUnit.test("sidebar find shows channels matching search term", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [],
channel_type: "channel",
group_public_id: false,
@@ -651,7 +651,7 @@ QUnit.test(
"sidebar find shows channels matching search term even when user is member",
async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_member_ids: [[0, 0, { partner_id: pyEnv.currentPartnerId }]],
channel_type: "channel",
group_public_id: false,
@@ -680,7 +680,7 @@ QUnit.test(
QUnit.test("sidebar channels should be ordered case insensitive alphabetically", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create([
+ pyEnv["discuss.channel"].create([
{ name: "Xyz" },
{ name: "abc" },
{ name: "Abc" },
@@ -701,7 +701,7 @@ QUnit.test("sidebar channels should be ordered case insensitive alphabetically",
QUnit.test("sidebar: public channel rendering", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
name: "channel1",
channel_type: "channel",
group_public_id: false,
@@ -714,7 +714,7 @@ QUnit.test("sidebar: public channel rendering", async (assert) => {
QUnit.test("channel - avatar: should have correct avatar", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
avatarCacheKey: "100111",
});
@@ -723,36 +723,36 @@ QUnit.test("channel - avatar: should have correct avatar", async (assert) => {
assert.containsOnce($, ".o-mail-DiscussCategoryItem img");
assert.containsOnce(
$,
- `img[data-src='/web/image/mail.channel/${channelId}/avatar_128?unique=100111']`
+ `img[data-src='/web/image/discuss.channel/${channelId}/avatar_128?unique=100111']`
);
});
QUnit.test("channel - avatar: should update avatar url from bus", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ avatarCacheKey: "101010" });
+ const channelId = pyEnv["discuss.channel"].create({ avatarCacheKey: "101010" });
const { env, openDiscuss } = await start();
await openDiscuss();
assert.containsOnce(
$,
- `img[data-src='/web/image/mail.channel/${channelId}/avatar_128?unique=101010']`
+ `img[data-src='/web/image/discuss.channel/${channelId}/avatar_128?unique=101010']`
);
await afterNextRender(() => {
- env.services.orm.call("mail.channel", "write", [
+ env.services.orm.call("discuss.channel", "write", [
[channelId],
{ image_128: "This field does not matter" },
]);
});
- const result = pyEnv["mail.channel"].searchRead([["id", "=", channelId]]);
+ const result = pyEnv["discuss.channel"].searchRead([["id", "=", channelId]]);
const newCacheKey = result[0]["avatarCacheKey"];
assert.containsOnce(
$,
- `img[data-src='/web/image/mail.channel/${channelId}/avatar_128?unique=${newCacheKey}']`
+ `img[data-src='/web/image/discuss.channel/${channelId}/avatar_128?unique=${newCacheKey}']`
);
});
QUnit.test("channel - states: close should update the value on the server", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "test" });
+ pyEnv["discuss.channel"].create({ name: "test" });
pyEnv["res.users.settings"].create({
user_id: pyEnv.currentUserId,
is_discuss_sidebar_category_channel_open: true,
@@ -777,7 +777,7 @@ QUnit.test("channel - states: close should update the value on the server", asyn
QUnit.test("channel - states: open should update the value on the server", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "test" });
+ pyEnv["discuss.channel"].create({ name: "test" });
pyEnv["res.users.settings"].create({
user_id: pyEnv.currentUserId,
is_discuss_sidebar_category_channel_open: false,
@@ -803,7 +803,7 @@ QUnit.test("channel - states: open should update the value on the server", async
QUnit.test("channel - states: close from the bus", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "test" });
+ pyEnv["discuss.channel"].create({ name: "test" });
const userSettingsId = pyEnv["res.users.settings"].create({
user_id: pyEnv.currentUserId,
is_discuss_sidebar_category_channel_open: true,
@@ -824,7 +824,7 @@ QUnit.test("channel - states: close from the bus", async (assert) => {
QUnit.test("channel - states: open from the bus", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "test" });
+ pyEnv["discuss.channel"].create({ name: "test" });
const userSettingsId = pyEnv["res.users.settings"].create({
user_id: pyEnv.currentUserId,
is_discuss_sidebar_category_channel_open: false,
@@ -847,7 +847,7 @@ QUnit.test(
"channel - states: the active category item should be visible even if the category is closed",
async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "test" });
+ pyEnv["discuss.channel"].create({ name: "test" });
const { openDiscuss } = await start();
await openDiscuss();
await click(".o-mail-DiscussCategoryItem:contains(test)");
@@ -864,7 +864,7 @@ QUnit.test(
QUnit.test("chat - states: open manually by clicking the title", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
channel_type: "chat",
});
pyEnv["res.users.settings"].create({
@@ -879,7 +879,7 @@ QUnit.test("chat - states: open manually by clicking the title", async (assert)
QUnit.test("chat - states: close should call update server data", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "test" });
+ pyEnv["discuss.channel"].create({ name: "test" });
pyEnv["res.users.settings"].create({
user_id: pyEnv.currentUserId,
is_discuss_sidebar_category_chat_open: true,
@@ -905,7 +905,7 @@ QUnit.test("chat - states: close should call update server data", async (assert)
QUnit.test("chat - states: open should call update server data", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "test" });
+ pyEnv["discuss.channel"].create({ name: "test" });
pyEnv["res.users.settings"].create({
user_id: pyEnv.currentUserId,
is_discuss_sidebar_category_chat_open: false,
@@ -931,7 +931,7 @@ QUnit.test("chat - states: open should call update server data", async (assert)
QUnit.test("chat - states: close from the bus", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ channel_type: "chat" });
+ pyEnv["discuss.channel"].create({ channel_type: "chat" });
const userSettingsId = pyEnv["res.users.settings"].create({
user_id: pyEnv.currentUserId,
is_discuss_sidebar_category_chat_open: true,
@@ -952,7 +952,7 @@ QUnit.test("chat - states: close from the bus", async (assert) => {
QUnit.test("chat - states: open from the bus", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ channel_type: "chat" });
+ pyEnv["discuss.channel"].create({ channel_type: "chat" });
const userSettingsId = pyEnv["res.users.settings"].create({
user_id: pyEnv.currentUserId,
is_discuss_sidebar_category_chat_open: false,
@@ -975,7 +975,7 @@ QUnit.test(
"chat - states: the active category item should be visible even if the category is closed",
async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ channel_type: "chat" });
+ pyEnv["discuss.channel"].create({ channel_type: "chat" });
const { openDiscuss } = await start();
await openDiscuss();
assert.containsOnce($, ".o-mail-DiscussCategory-chat .fa-chevron-down");
@@ -1000,14 +1000,14 @@ QUnit.test("chat - avatar: should have correct avatar", async (assert) => {
name: "Demo",
im_status: "offline",
});
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: partnerId }],
],
channel_type: "chat",
});
- const channel = pyEnv["mail.channel"].searchRead([["id", "=", channelId]])[0];
+ const channel = pyEnv["discuss.channel"].searchRead([["id", "=", channelId]])[0];
const { openDiscuss } = await start();
await openDiscuss();
@@ -1022,7 +1022,7 @@ QUnit.test("chat should be sorted by last activity time [REQUIRE FOCUS]", async
const pyEnv = await startServer();
const [demo_id, yoshi_id] = pyEnv["res.partner"].create([{ name: "Demo" }, { name: "Yoshi" }]);
pyEnv["res.users"].create([{ partner_id: demo_id }, { partner_id: yoshi_id }]);
- pyEnv["mail.channel"].create([
+ pyEnv["discuss.channel"].create([
{
channel_member_ids: [
[
@@ -1071,7 +1071,7 @@ QUnit.test("chat should be sorted by last activity time [REQUIRE FOCUS]", async
QUnit.test("Can unpin chat channel", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ channel_type: "chat" });
+ pyEnv["discuss.channel"].create({ channel_type: "chat" });
const { openDiscuss } = await start();
await openDiscuss();
assert.containsOnce($, ".o-mail-DiscussCategoryItem:contains(Mitchell Admin)");
@@ -1081,7 +1081,7 @@ QUnit.test("Can unpin chat channel", async (assert) => {
QUnit.test("Unpinning chat should display notification", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ channel_type: "chat" });
+ pyEnv["discuss.channel"].create({ channel_type: "chat" });
const { openDiscuss } = await start({
services: {
notification: makeFakeNotificationService((message) => assert.step(message)),
@@ -1094,21 +1094,21 @@ QUnit.test("Unpinning chat should display notification", async (assert) => {
QUnit.test("Can leave channel", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const { env, openDiscuss } = await start();
await openDiscuss(channelId);
assert.containsOnce($, ".o-mail-DiscussCategoryItem:contains(General)");
const messageId = pyEnv["mail.message"].create({
body: 'Mitchell Admin left the channel
',
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
const [message] = await env.services.orm.call("mail.message", "message_format", [[messageId]]);
await afterNextRender(() => {
pyEnv["bus.bus"]._sendmany([
- [channelId, "mail.channel/leave", { id: channelId }],
- [channelId, "mail.channel/new_message", { id: channelId, message }],
+ [channelId, "discuss.channel/leave", { id: channelId }],
+ [channelId, "discuss.channel/new_message", { id: channelId, message }],
]);
});
assert.containsNone($, ".o-mail-DiscussCategoryItem:contains(General)");
@@ -1116,7 +1116,7 @@ QUnit.test("Can leave channel", async (assert) => {
QUnit.test("Do no channel_info after unpin", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General", channel_type: "chat" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General", channel_type: "chat" });
const { env, openDiscuss } = await start({
mockRPC(route, args, originalRPC) {
if (args.method === "channel_info") {
@@ -1130,7 +1130,7 @@ QUnit.test("Do no channel_info after unpin", async (assert) => {
await afterNextRender(() => {
env.services.rpc("/mail/message/post", {
thread_id: channelId,
- thread_model: "mail.channel",
+ thread_model: "discuss.channel",
post_data: {
body: "Hello world",
message_type: "comment",
@@ -1144,7 +1144,7 @@ QUnit.test("Do no channel_info after unpin", async (assert) => {
QUnit.test("Group unread counter up to date after mention is marked as seen", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Chuck" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: partnerId }],
@@ -1153,7 +1153,7 @@ QUnit.test("Group unread counter up to date after mention is marked as seen", as
});
const messageId = pyEnv["mail.message"].create({
author_id: partnerId,
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
body: "@Mitchell Admin",
needaction: true,
diff --git a/addons/mail/static/tests/emoji/emoji_tests.js b/addons/mail/static/tests/emoji/emoji_tests.js
index ba5c7afcf46..bd5eb35b70c 100644
--- a/addons/mail/static/tests/emoji/emoji_tests.js
+++ b/addons/mail/static/tests/emoji/emoji_tests.js
@@ -15,7 +15,7 @@ QUnit.module("emoji");
QUnit.test("search emoji from keywords", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await click("button[aria-label='Emojis']");
@@ -25,7 +25,7 @@ QUnit.test("search emoji from keywords", async (assert) => {
QUnit.test("search emoji from keywords with special regex character", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await click("button[aria-label='Emojis']");
@@ -35,7 +35,7 @@ QUnit.test("search emoji from keywords with special regex character", async (ass
QUnit.test("Press Escape in emoji picker closes the emoji picker", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await click("button[aria-label='Emojis']");
@@ -45,7 +45,7 @@ QUnit.test("Press Escape in emoji picker closes the emoji picker", async (assert
QUnit.test("Basic keyboard navigation", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await click("button[aria-label='Emojis']");
@@ -73,7 +73,7 @@ QUnit.test("Basic keyboard navigation", async (assert) => {
QUnit.test("recent category (basic)", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await click("button[aria-label='Emojis']");
@@ -89,7 +89,7 @@ QUnit.test("recent category (basic)", async (assert) => {
QUnit.test("emoji usage amount orders frequent emojis", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await click("button[aria-label='Emojis']");
@@ -115,7 +115,7 @@ QUnit.test("emoji usage amount orders frequent emojis", async (assert) => {
QUnit.test("posting :wink: in message should impact recent", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await insertText(".o-mail-Composer-input", ":wink:");
@@ -130,7 +130,7 @@ QUnit.test("posting :wink: in message should impact recent", async (assert) => {
QUnit.test("posting :snowman: in message should impact recent", async (assert) => {
// the snowman emoji is composed of two codepoints, making it a corner case
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await insertText(".o-mail-Composer-input", ":snowman:");
@@ -144,7 +144,7 @@ QUnit.test("posting :snowman: in message should impact recent", async (assert) =
QUnit.test("first category should be highlight by default", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await click("button[aria-label='Emojis']");
diff --git a/addons/mail/static/tests/helpers/mock_server/controllers/bus.js b/addons/mail/static/tests/helpers/mock_server/controllers/bus.js
index eb1d5c144b7..b791fe5f8ce 100644
--- a/addons/mail/static/tests/helpers/mock_server/controllers/bus.js
+++ b/addons/mail/static/tests/helpers/mock_server/controllers/bus.js
@@ -26,8 +26,8 @@ patch(MockServer.prototype, "mail/controllers/bus", {
* @returns {Object} one key for list of followers and one for subtypes
*/
async _mockRouteMailChatPost(uuid, message_content, context = {}) {
- const mailChannel = this.getRecords("mail.channel", [["uuid", "=", uuid]])[0];
- if (!mailChannel) {
+ const channel = this.getRecords("discuss.channel", [["uuid", "=", uuid]])[0];
+ if (!channel) {
return false;
}
@@ -48,13 +48,13 @@ patch(MockServer.prototype, "mail/controllers/bus", {
} else {
author_id = false;
// simpler fallback than catchall_formatted
- email_from = mailChannel.anonymous_name || "catchall@example.com";
+ email_from = channel.anonymous_name || "catchall@example.com";
}
// supposedly should convert plain text to html
const body = message_content;
// ideally should be posted with mail_create_nosubscribe=True
- return this._mockMailChannelMessagePost(
- mailChannel.id,
+ return this._mockDiscussChannelMessagePost(
+ channel.id,
{
author_id,
email_from,
diff --git a/addons/mail/static/tests/helpers/mock_server/controllers/discuss.js b/addons/mail/static/tests/helpers/mock_server/controllers/discuss.js
index 088271f5e4b..1bb1085751f 100644
--- a/addons/mail/static/tests/helpers/mock_server/controllers/discuss.js
+++ b/addons/mail/static/tests/helpers/mock_server/controllers/discuss.js
@@ -39,29 +39,29 @@ patch(MockServer.prototype, "mail/controllers/discuss", {
const { attachment_id } = args;
return this._mockRouteMailAttachmentRemove(attachment_id);
}
- if (route === "/mail/channel/messages") {
+ if (route === "/discuss/channel/messages") {
const { channel_id, after, around, before, limit } = args;
- return this._mockRouteMailChannelMessages(channel_id, before, after, around, limit);
+ return this._mockRouteDiscussChannelMessages(channel_id, before, after, around, limit);
}
- if (route === "/mail/channel/pinned_messages") {
+ if (route === "/discuss/channel/pinned_messages") {
const { channel_id } = args;
- return this._mockRouteMailChannelPins(channel_id);
+ return this._mockRouteDiscussChannelPins(channel_id);
}
- if (route === "/mail/channel/notify_typing") {
+ if (route === "/discuss/channel/notify_typing") {
const id = args.channel_id;
const is_typing = args.is_typing;
const context = args.context;
- return this._mockRouteMailChannelNotifyTyping(id, is_typing, context);
+ return this._mockRouteDiscussChannelNotifyTyping(id, is_typing, context);
}
- if (new RegExp("/mail/channel/\\d+/partner/\\d+/avatar_128").test(route)) {
+ if (new RegExp("/discuss/channel/\\d+/partner/\\d+/avatar_128").test(route)) {
return;
}
- if (route === "/mail/channel/ping") {
+ if (route === "/discuss/channel/ping") {
return;
}
- if (route === "/mail/channel/members") {
+ if (route === "/discuss/channel/members") {
const { channel_id, known_member_ids } = args;
- return this._mockMailChannelloadOlderMembers([channel_id], known_member_ids);
+ return this._mockDiscussChannelloadOlderMembers([channel_id], known_member_ids);
}
if (route === "/mail/history/messages") {
const { after, before, limit } = args;
@@ -95,8 +95,8 @@ patch(MockServer.prototype, "mail/controllers/discuss", {
return this._mockRouteMailLoadMessageFailures();
}
if (route === "/mail/message/post") {
- if (args.thread_model === "mail.channel") {
- return this._mockMailChannelMessagePost(
+ if (args.thread_model === "discuss.channel") {
+ return this._mockDiscussChannelMessagePost(
args.thread_id,
args.post_data,
args.context
@@ -170,11 +170,11 @@ patch(MockServer.prototype, "mail/controllers/discuss", {
return this._super(route, args);
},
/**
- * Simulates the `/mail/channel/pinned_messages` route.
+ * Simulates the `/discuss/channel/pinned_messages` route.
*/
- _mockRouteMailChannelPins(channel_id) {
+ _mockRouteDiscussChannelPins(channel_id) {
const messageIds = this.pyEnv["mail.message"].search([
- ["model", "=", "mail.channel"],
+ ["model", "=", "discuss.channel"],
["res_id", "=", channel_id],
["pinned_at", "!=", false],
]);
@@ -202,7 +202,7 @@ patch(MockServer.prototype, "mail/controllers/discuss", {
return this.pyEnv["ir.attachment"].unlink([attachment_id]);
},
/**
- * Simulates the `/mail/channel/messages` route.
+ * Simulates the `/discuss/channel/messages` route.
*
* @private
* @param {integer} channel_id
@@ -212,7 +212,7 @@ patch(MockServer.prototype, "mail/controllers/discuss", {
* @param {integer} around
* @returns {Object} list of messages
*/
- async _mockRouteMailChannelMessages(
+ async _mockRouteDiscussChannelMessages(
channel_id,
before = false,
after = false,
@@ -221,7 +221,7 @@ patch(MockServer.prototype, "mail/controllers/discuss", {
) {
const domain = [
["res_id", "=", channel_id],
- ["model", "=", "mail.channel"],
+ ["model", "=", "discuss.channel"],
["message_type", "!=", "user_notification"],
];
const messages = this._mockMailMessage_MessageFetch(domain, before, after, around, limit);
@@ -231,23 +231,23 @@ patch(MockServer.prototype, "mail/controllers/discuss", {
return this._mockMailMessageMessageFormat(messages.map((message) => message.id));
},
/**
- * Simulates the `/mail/channel/notify_typing` route.
+ * Simulates the `/discuss/channel/notify_typing` route.
*
* @private
* @param {integer} channel_id
* @param {integer} limit
* @param {Object} [context={}]
*/
- async _mockRouteMailChannelNotifyTyping(channel_id, is_typing, context = {}) {
+ async _mockRouteDiscussChannelNotifyTyping(channel_id, is_typing, context = {}) {
const partnerId = context.mockedPartnerId || this.currentPartnerId;
- const [memberOfCurrentUser] = this.getRecords("mail.channel.member", [
+ const [memberOfCurrentUser] = this.getRecords("discuss.channel.member", [
["channel_id", "=", channel_id],
["partner_id", "=", partnerId],
]);
if (!memberOfCurrentUser) {
return;
}
- this._mockMailChannelMember_NotifyTyping([memberOfCurrentUser.id], is_typing);
+ this._mockDiscussChannelMember_NotifyTyping([memberOfCurrentUser.id], is_typing);
},
/**
* Simulates the `/mail/load_message_failures` route.
@@ -280,8 +280,8 @@ patch(MockServer.prototype, "mail/controllers/discuss", {
]);
linkPreviews.push(this._mockMailLinkPreviewFormat(linkPreview));
let target = this.pyEnv.currentPartner;
- if (message.model === "mail.channel") {
- target = this.pyEnv["mail.channel"].search([["id", "=", message.res_id]]);
+ if (message.model === "discuss.channel") {
+ target = this.pyEnv["discuss.channel"].search([["id", "=", message.res_id]]);
}
this.pyEnv["bus.bus"]._sendmany([
[target, "mail.record/insert", { LinkPreview: linkPreviews }],
@@ -404,18 +404,18 @@ patch(MockServer.prototype, "mail/controllers/discuss", {
* @returns {integer[]} [check_rtc_session_ids]
*/
async _mockRouteMailRtcChannelJoinCall(channel_id, check_rtc_session_ids = []) {
- const [currentChannelMember] = this.getRecords("mail.channel.member", [
+ const [currentChannelMember] = this.getRecords("discuss.channel.member", [
["channel_id", "=", channel_id],
["partner_id", "=", this.currentPartnerId],
]);
- const sessionId = this.pyEnv["mail.channel.rtc.session"].create({
+ const sessionId = this.pyEnv["discuss.channel.rtc.session"].create({
channel_member_id: currentChannelMember.id,
channel_id, // on the server, this is a related field from channel_member_id and not explicitly set
});
- const channelMembers = this.getRecords("mail.channel.member", [
+ const channelMembers = this.getRecords("discuss.channel.member", [
["channel_id", "=", channel_id],
]);
- const rtcSessions = this.getRecords("mail.channel.rtc.session", [
+ const rtcSessions = this.getRecords("discuss.channel.rtc.session", [
["channel_member_id", "in", channelMembers.map((channelMember) => channelMember.id)],
]);
return {
@@ -424,7 +424,9 @@ patch(MockServer.prototype, "mail/controllers/discuss", {
[
"insert",
rtcSessions.map((rtcSession) =>
- this._mockMailChannelRtcSession_MailChannelRtcSessionFormat(rtcSession.id)
+ this._mockDiscussChannelRtcSession_DiscussChannelRtcSessionFormat(
+ rtcSession.id
+ )
),
],
],
@@ -438,23 +440,24 @@ patch(MockServer.prototype, "mail/controllers/discuss", {
* @param {integer} channelId
*/
async _mockRouteMailRtcChannelLeaveCall(channel_id) {
- const channelMembers = this.getRecords("mail.channel.member", [
+ const channelMembers = this.getRecords("discuss.channel.member", [
["channel_id", "=", channel_id],
]);
- const rtcSessions = this.getRecords("mail.channel.rtc.session", [
+ const rtcSessions = this.getRecords("discuss.channel.rtc.session", [
["channel_member_id", "in", channelMembers.map((channelMember) => channelMember.id)],
]);
const notifications = [];
- const channelInfo = this._mockMailChannelRtcSession_MailChannelRtcSessionFormatByChannel(
- rtcSessions.map((rtcSession) => rtcSession.id)
- );
+ const channelInfo =
+ this._mockDiscussChannelRtcSession_DiscussChannelRtcSessionFormatByChannel(
+ rtcSessions.map((rtcSession) => rtcSession.id)
+ );
for (const [channelId, sessionsData] of Object.entries(channelInfo)) {
const notificationRtcSessions = sessionsData.map((sessionsDataPoint) => {
return { id: sessionsDataPoint.id };
});
notifications.push([
channelId,
- "mail.channel/rtc_sessions_update",
+ "discuss.channel/rtc_sessions_update",
{
id: Number(channelId), // JS object keys are strings, but the type from the server is number
rtcSessions: [["insert-and-unlink", notificationRtcSessions]],
@@ -465,7 +468,7 @@ patch(MockServer.prototype, "mail/controllers/discuss", {
const target = rtcSession.guest_id || rtcSession.partner_id;
notifications.push([
target,
- "mail.channel.rtc.session/ended",
+ "discuss.channel.rtc.session/ended",
{ sessionId: rtcSession.id },
]);
}
@@ -489,7 +492,7 @@ patch(MockServer.prototype, "mail/controllers/discuss", {
res["hasReadAccess"] = false;
return res;
}
- res["canPostOnReadonly"] = thread_model === "mail.channel"; // model that have attr _mail_post_access='read'
+ res["canPostOnReadonly"] = thread_model === "discuss.channel"; // model that have attr _mail_post_access='read'
if (request_list.includes("activities")) {
const activities = this.pyEnv["mail.activity"].searchRead([
["id", "in", thread.activity_ids || []],
diff --git a/addons/mail/static/tests/helpers/mock_server/models/mail_channel.js b/addons/mail/static/tests/helpers/mock_server/models/discuss_channel.js
similarity index 67%
rename from addons/mail/static/tests/helpers/mock_server/models/mail_channel.js
rename to addons/mail/static/tests/helpers/mock_server/models/discuss_channel.js
index d55ad18cd25..acde9dd30ac 100644
--- a/addons/mail/static/tests/helpers/mock_server/models/mail_channel.js
+++ b/addons/mail/static/tests/helpers/mock_server/models/discuss_channel.js
@@ -7,38 +7,38 @@ import { datetime_to_str } from "web.time";
import { assignDefined } from "@mail/utils/misc";
import { formatDate } from "@web/core/l10n/dates";
-patch(MockServer.prototype, "mail/models/mail_channel", {
+patch(MockServer.prototype, "mail/models/discuss_channel", {
async _performRPC(route, args) {
- if (args.model === "mail.channel" && args.method === "action_unfollow") {
+ if (args.model === "discuss.channel" && args.method === "action_unfollow") {
const ids = args.args[0];
- return this._mockMailChannelActionUnfollow(ids, args.kwargs.context);
+ return this._mockDiscussChannelActionUnfollow(ids, args.kwargs.context);
}
- if (args.model === "mail.channel" && args.method === "channel_fetched") {
+ if (args.model === "discuss.channel" && args.method === "channel_fetched") {
const ids = args.args[0];
- return this._mockMailChannelChannelFetched(ids);
+ return this._mockDiscussChannelChannelFetched(ids);
}
- if (args.model === "mail.channel" && args.method === "channel_fetch_preview") {
+ if (args.model === "discuss.channel" && args.method === "channel_fetch_preview") {
const ids = args.args[0];
- return this._mockMailChannelChannelFetchPreview(ids);
+ return this._mockDiscussChannelChannelFetchPreview(ids);
}
- if (args.model === "mail.channel" && args.method === "channel_fold") {
+ if (args.model === "discuss.channel" && args.method === "channel_fold") {
const ids = args.args[0];
const state = args.args[1] || args.kwargs.state;
- return this._mockMailChannelChannelFold(ids, state);
+ return this._mockDiscussChannelChannelFold(ids, state);
}
- if (args.model === "mail.channel" && args.method === "channel_create") {
+ if (args.model === "discuss.channel" && args.method === "channel_create") {
const name = args.args[0];
const groupId = args.args[1];
- return this._mockMailChannelChannelCreate(name, groupId);
+ return this._mockDiscussChannelChannelCreate(name, groupId);
}
- if (args.model === "mail.channel" && args.method === "set_message_pin") {
- return this._mockMailChannelSetMessagePin(
+ if (args.model === "discuss.channel" && args.method === "set_message_pin") {
+ return this._mockDiscussChannelSetMessagePin(
args.args[0],
args.kwargs.message_id,
args.kwargs.pinned
);
}
- if (args.model === "mail.channel" && args.method === "channel_get") {
+ if (args.model === "discuss.channel" && args.method === "channel_get") {
const partners_to = args.args[0] || args.kwargs.partners_to;
const pin =
args.args[1] !== undefined
@@ -46,72 +46,72 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
: args.kwargs.pin !== undefined
? args.kwargs.pin
: undefined;
- return this._mockMailChannelChannelGet(partners_to, pin);
+ return this._mockDiscussChannelChannelGet(partners_to, pin);
}
- if (args.model === "mail.channel" && args.method === "channel_info") {
+ if (args.model === "discuss.channel" && args.method === "channel_info") {
const ids = args.args[0];
- return this._mockMailChannelChannelInfo(ids);
+ return this._mockDiscussChannelChannelInfo(ids);
}
- if (args.model === "mail.channel" && args.method === "add_members") {
+ if (args.model === "discuss.channel" && args.method === "add_members") {
const ids = args.args[0];
const partner_ids = args.args[1] || args.kwargs.partner_ids;
- return this._mockMailChannelAddMembers(ids, partner_ids, args.kwargs.context);
+ return this._mockDiscussChannelAddMembers(ids, partner_ids, args.kwargs.context);
}
- if (args.model === "mail.channel" && args.method === "channel_pin") {
+ if (args.model === "discuss.channel" && args.method === "channel_pin") {
const ids = args.args[0];
const pinned = args.args[1] || args.kwargs.pinned;
- return this._mockMailChannelChannelPin(ids, pinned);
+ return this._mockDiscussChannelChannelPin(ids, pinned);
}
- if (args.model === "mail.channel" && args.method === "channel_rename") {
+ if (args.model === "discuss.channel" && args.method === "channel_rename") {
const ids = args.args[0];
const name = args.args[1] || args.kwargs.name;
- return this._mockMailChannelChannelRename(ids, name);
+ return this._mockDiscussChannelChannelRename(ids, name);
}
- if (args.model === "mail.channel" && args.method === "channel_change_description") {
+ if (args.model === "discuss.channel" && args.method === "channel_change_description") {
const ids = args.args[0];
const description = args.args[1] || args.kwargs.description;
- return this._mockMailChannelChannelChangeDescription(ids, description);
+ return this._mockDiscussChannelChannelChangeDescription(ids, description);
}
- if (route === "/mail/channel/set_last_seen_message") {
+ if (route === "/discuss/channel/set_last_seen_message") {
const id = args.channel_id;
const last_message_id = args.last_message_id;
- return this._mockMailChannel_ChannelSeen([id], last_message_id);
+ return this._mockDiscussChannel_ChannelSeen([id], last_message_id);
}
- if (args.model === "mail.channel" && args.method === "channel_set_custom_name") {
+ if (args.model === "discuss.channel" && args.method === "channel_set_custom_name") {
const ids = args.args[0];
const name = args.args[1] || args.kwargs.name;
- return this._mockMailChannelChannelSetCustomName(ids, name);
+ return this._mockDiscussChannelChannelSetCustomName(ids, name);
}
- if (args.model === "mail.channel" && args.method === "create_group") {
+ if (args.model === "discuss.channel" && args.method === "create_group") {
const partners_to = args.args[0] || args.kwargs.partners_to;
- return this._mockMailChannelCreateGroup(partners_to);
+ return this._mockDiscussChannelCreateGroup(partners_to);
}
- if (args.model === "mail.channel" && args.method === "execute_command_leave") {
- return this._mockMailChannelExecuteCommandLeave(args);
+ if (args.model === "discuss.channel" && args.method === "execute_command_leave") {
+ return this._mockDiscussChannelExecuteCommandLeave(args);
}
- if (args.model === "mail.channel" && args.method === "execute_command_who") {
- return this._mockMailChannelExecuteCommandWho(args);
+ if (args.model === "discuss.channel" && args.method === "execute_command_who") {
+ return this._mockDiscussChannelExecuteCommandWho(args);
}
if (
- args.model === "mail.channel" &&
+ args.model === "discuss.channel" &&
args.method === "write" &&
"image_128" in args.args[1]
) {
const ids = args.args[0];
- return this._mockMailChannelWriteImage128(ids[0]);
+ return this._mockDiscussChannelWriteImage128(ids[0]);
}
- if (args.model === "mail.channel" && args.method === "load_more_members") {
+ if (args.model === "discuss.channel" && args.method === "load_more_members") {
const [channel_ids] = args.args;
const { known_member_ids } = args.kwargs;
- return this._mockMailChannelloadOlderMembers(channel_ids, known_member_ids);
+ return this._mockDiscussChannelloadOlderMembers(channel_ids, known_member_ids);
}
- if (args.model === "mail.channel" && args.method === "get_mention_suggestions") {
- return this._mockMailChannelGetMentionSuggestions(args);
+ if (args.model === "discuss.channel" && args.method === "get_mention_suggestions") {
+ return this._mockDiscussChannelGetMentionSuggestions(args);
}
return this._super(route, args);
},
/**
- * Simulates `message_post` on `mail.channel`.
+ * Simulates `message_post` on `discuss.channel`.
*
* @private
* @param {integer} id
@@ -119,21 +119,21 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
* @param {Object} [context]
* @returns {integer|false}
*/
- _mockMailChannelMessagePost(id, kwargs, context) {
+ _mockDiscussChannelMessagePost(id, kwargs, context) {
const message_type = kwargs.message_type || "notification";
- const channel = this.getRecords("mail.channel", [["id", "=", id]])[0];
+ const channel = this.getRecords("discuss.channel", [["id", "=", id]])[0];
if (channel.channel_type !== "channel") {
- const [memberOfCurrentUser] = this.getRecords("mail.channel.member", [
+ const [memberOfCurrentUser] = this.getRecords("discuss.channel.member", [
["channel_id", "=", channel.id],
["partner_id", "=", this.currentPartnerId],
]);
- this.pyEnv["mail.channel.member"].write([memberOfCurrentUser.id], {
+ this.pyEnv["discuss.channel.member"].write([memberOfCurrentUser.id], {
last_interest_dt: datetime_to_str(new Date()),
is_pinned: true,
});
}
const messageData = this._mockMailThreadMessagePost(
- "mail.channel",
+ "discuss.channel",
[id],
Object.assign(kwargs, {
message_type,
@@ -141,52 +141,52 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
context
);
if (kwargs.author_id === this.currentPartnerId) {
- this._mockMailChannel_SetLastSeenMessage([channel.id], messageData.id);
+ this._mockDiscussChannel_SetLastSeenMessage([channel.id], messageData.id);
}
// simulate compute of message_unread_counter
- const otherMembers = this.getRecords("mail.channel.member", [
+ const otherMembers = this.getRecords("discuss.channel.member", [
["channel_id", "=", channel.id],
["partner_id", "!=", this.currentPartnerId],
]);
for (const member of otherMembers) {
- this.pyEnv["mail.channel.member"].write([member.id], {
+ this.pyEnv["discuss.channel.member"].write([member.id], {
message_unread_counter: member.message_unread_counter + 1,
});
}
return messageData;
},
/**
- * Simulates `action_unfollow` on `mail.channel`.
+ * Simulates `action_unfollow` on `discuss.channel`.
*
* @private
* @param {integer[]} ids
*/
- _mockMailChannelActionUnfollow(ids, { mockedUserId } = {}) {
+ _mockDiscussChannelActionUnfollow(ids, { mockedUserId } = {}) {
let partnerId = this.currentPartnerId;
if (mockedUserId) {
partnerId = this.pyEnv["res.partner"].search([["user_ids", "in", [mockedUserId]]])[0];
}
- const channel = this.getRecords("mail.channel", [["id", "in", ids]])[0];
- const [channelMember] = this.getRecords("mail.channel.member", [
+ const channel = this.getRecords("discuss.channel", [["id", "in", ids]])[0];
+ const [channelMember] = this.getRecords("discuss.channel.member", [
["channel_id", "in", ids],
["partner_id", "=", partnerId],
]);
- const formattedChannelMember = this._mockMailChannelMember_MailChannelMemberFormat([
+ const formattedChannelMember = this._mockDiscussChannelMember_DiscussChannelMemberFormat([
channelMember.id,
])[0];
if (!channelMember) {
return true;
}
- this.pyEnv["mail.channel"].write([channel.id], {
+ this.pyEnv["discuss.channel"].write([channel.id], {
channel_member_ids: [[2, channelMember.id]],
});
if (partnerId === this.currentPartnerId) {
- this.pyEnv["bus.bus"]._sendone(this.pyEnv.currentPartner, "mail.channel/leave", {
+ this.pyEnv["bus.bus"]._sendone(this.pyEnv.currentPartner, "discuss.channel/leave", {
id: channel.id,
});
}
const isSelfMember =
- this.pyEnv["mail.channel.member"].searchCount([
+ this.pyEnv["discuss.channel.member"].searchCount([
["partner_id", "=", this.pyEnv.currentPartnerId],
["channel_id", "=", channel.id],
]) > 0;
@@ -195,7 +195,7 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
Channel: {
id: channel.id,
channelMembers: [["insert-and-unlink", formattedChannelMember]],
- memberCount: this.pyEnv["mail.channel.member"].searchCount([
+ memberCount: this.pyEnv["discuss.channel.member"].searchCount([
["channel_id", "=", channel.id],
]),
},
@@ -209,7 +209,7 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
* for unsubscribe is weak and is relying on both of them to be sent
* together on the bus).
*/
- // this._mockMailChannelMessagePost(channel.id, {
+ // this._mockDiscussChannelMessagePost(channel.id, {
// author_id: this.currentPartnerId,
// body: 'left the channel
',
// subtype_xmlid: "mail.mt_comment",
@@ -217,38 +217,38 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
return true;
},
/**
- * Simulates `add_members` on `mail.channel`.
+ * Simulates `add_members` on `discuss.channel`.
*
* @private
* @param {integer[]} ids
* @param {integer[]} partner_ids
*/
- _mockMailChannelAddMembers(ids, partner_ids, context = {}) {
- const [channel] = this.getRecords("mail.channel", [["id", "in", ids]]);
+ _mockDiscussChannelAddMembers(ids, partner_ids, context = {}) {
+ const [channel] = this.getRecords("discuss.channel", [["id", "in", ids]]);
const partners = this.getRecords("res.partner", [["id", "in", partner_ids]]);
for (const partner of partners) {
const body = `invited ${partner.name} to the channel
`;
const message_type = "notification";
const subtype_xmlid = "mail.mt_comment";
- this._mockMailChannelMessagePost(channel.id, { body, message_type, subtype_xmlid });
+ this._mockDiscussChannelMessagePost(channel.id, { body, message_type, subtype_xmlid });
}
const insertedChannelMembers = [];
for (const partner of partners) {
insertedChannelMembers.push(
- this.pyEnv["mail.channel.member"].create({
+ this.pyEnv["discuss.channel.member"].create({
channel_id: channel.id,
partner_id: partner.id,
})
);
}
if (partner_ids.includes(this.pyEnv.currentPartnerId)) {
- this.pyEnv["bus.bus"]._sendone(channel, "mail.channel/joined", {
- channel: this._mockMailChannelChannelInfo([channel.id])[0],
+ this.pyEnv["bus.bus"]._sendone(channel, "discuss.channel/joined", {
+ channel: this._mockDiscussChannelChannelInfo([channel.id])[0],
invited_by_user_id: context.mockedUserId ?? this.currentUserId,
});
}
const isSelfMember =
- this.pyEnv["mail.channel.member"].searchCount([
+ this.pyEnv["discuss.channel.member"].searchCount([
["partner_id", "=", this.pyEnv.currentPartnerId],
["channel_id", "=", channel.id],
]) > 0;
@@ -259,12 +259,12 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
channelMembers: [
[
"insert",
- this._mockMailChannelMember_MailChannelMemberFormat(
+ this._mockDiscussChannelMember_DiscussChannelMemberFormat(
insertedChannelMembers
),
],
],
- memberCount: this.pyEnv["mail.channel.member"].searchCount([
+ memberCount: this.pyEnv["discuss.channel.member"].searchCount([
["channel_id", "=", channel.id],
]),
},
@@ -272,13 +272,13 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
}
},
/**
- * Simulates `set_message_pin` on `mail.channel`.
+ * Simulates `set_message_pin` on `discuss.channel`.
*
* @param {number} ids
* @param {number} message_id
* @param {boolean} pinned
*/
- _mockMailChannelSetMessagePin(id, message_id, pinned) {
+ _mockDiscussChannelSetMessagePin(id, message_id, pinned) {
const pinnedAt = pinned ? formatDate(luxon.DateTime.now()) : false;
this.pyEnv["mail.message"].write([message_id], {
pinned_at: pinnedAt,
@@ -288,7 +288,7 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
message to this channel.
See all pinned messages
`;
- this._mockMailChannelMessagePost(id, {
+ this._mockDiscussChannelMessagePost(id, {
body: notification,
message_type: "notification",
subtype_xmlid: "mail.mt_comment",
@@ -301,26 +301,29 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
});
},
/**
- * Simulates `_broadcast` on `mail.channel`.
+ * Simulates `_broadcast` on `discuss.channel`.
*
* @private
* @param {integer} id
* @param {integer[]} partner_ids
* @returns {Object}
*/
- _mockMailChannel_broadcast(ids, partner_ids) {
- const notifications = this._mockMailChannel_channelChannelNotifications(ids, partner_ids);
+ _mockDiscussChannel_broadcast(ids, partner_ids) {
+ const notifications = this._mockDiscussChannel_channelChannelNotifications(
+ ids,
+ partner_ids
+ );
this.pyEnv["bus.bus"]._sendmany(notifications);
},
/**
- * Simulates `_channel_channel_notifications` on `mail.channel`.
+ * Simulates `_channel_channel_notifications` on `discuss.channel`.
*
* @private
* @param {integer} id
* @param {integer[]} partner_ids
* @returns {Object}
*/
- _mockMailChannel_channelChannelNotifications(ids, partner_ids) {
+ _mockDiscussChannel_channelChannelNotifications(ids, partner_ids) {
const notifications = [];
for (const partner_id of partner_ids) {
const user = this.getRecords("res.users", [["partner_id", "in", partner_id]])[0];
@@ -329,28 +332,28 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
}
// Note: `channel_info` on the server is supposed to be called with
// the proper user context but this is not done here for simplicity.
- const channelInfos = this._mockMailChannelChannelInfo(ids);
+ const channelInfos = this._mockDiscussChannelChannelInfo(ids);
const [relatedPartner] = this.pyEnv["res.partner"].searchRead([
["id", "=", partner_id],
]);
for (const channelInfo of channelInfos) {
- notifications.push([relatedPartner, "mail.channel/legacy_insert", channelInfo]);
+ notifications.push([relatedPartner, "discuss.channel/legacy_insert", channelInfo]);
}
}
return notifications;
},
/**
- * Simulates `channel_fetched` on `mail.channel`.
+ * Simulates `channel_fetched` on `discuss.channel`.
*
* @private
* @param {integer[]} ids
* @param {string} extra_info
*/
- _mockMailChannelChannelFetched(ids) {
- const channels = this.getRecords("mail.channel", [["id", "in", ids]]);
+ _mockDiscussChannelChannelFetched(ids) {
+ const channels = this.getRecords("discuss.channel", [["id", "in", ids]]);
for (const channel of channels) {
const channelMessages = this.getRecords("mail.message", [
- ["model", "=", "mail.channel"],
+ ["model", "=", "discuss.channel"],
["res_id", "=", channel.id],
]);
const lastMessage = channelMessages.reduce((lastMessage, message) => {
@@ -362,14 +365,14 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
if (!lastMessage) {
continue;
}
- const [memberOfCurrentUser] = this.getRecords("mail.channel.member", [
+ const [memberOfCurrentUser] = this.getRecords("discuss.channel.member", [
["channel_id", "=", channel.id],
["partner_id", "=", this.currentPartnerId],
]);
- this.pyEnv["mail.channel.member"].write([memberOfCurrentUser.id], {
+ this.pyEnv["discuss.channel.member"].write([memberOfCurrentUser.id], {
fetched_message_id: lastMessage.id,
});
- this.pyEnv["bus.bus"]._sendone(channel, "mail.channel.member/fetched", {
+ this.pyEnv["bus.bus"]._sendone(channel, "discuss.channel.member/fetched", {
channel_id: channel.id,
id: memberOfCurrentUser.id,
last_message_id: lastMessage.id,
@@ -378,18 +381,18 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
}
},
/**
- * Simulates `channel_fetch_preview` on `mail.channel`.
+ * Simulates `channel_fetch_preview` on `discuss.channel`.
*
* @private
* @param {integer[]} ids
* @returns {Object[]} list of channels previews
*/
- _mockMailChannelChannelFetchPreview(ids) {
- const channels = this.getRecords("mail.channel", [["id", "in", ids]]);
+ _mockDiscussChannelChannelFetchPreview(ids) {
+ const channels = this.getRecords("discuss.channel", [["id", "in", ids]]);
return channels
.map((channel) => {
const channelMessages = this.getRecords("mail.message", [
- ["model", "=", "mail.channel"],
+ ["model", "=", "discuss.channel"],
["res_id", "=", channel.id],
]);
const lastMessage = channelMessages.reduce((lastMessage, message) => {
@@ -408,17 +411,17 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
.filter((preview) => preview.last_message);
},
/**
- * Simulates the 'channel_fold' route on `mail.channel`.
+ * Simulates the 'channel_fold' route on `discuss.channel`.
* In particular sends a notification on the bus.
*
* @private
* @param {number} ids
* @param {state} [state]
*/
- _mockMailChannelChannelFold(ids, state) {
- const channels = this.getRecords("mail.channel", [["id", "in", ids]]);
+ _mockDiscussChannelChannelFold(ids, state) {
+ const channels = this.getRecords("discuss.channel", [["id", "in", ids]]);
for (const channel of channels) {
- const [memberOfCurrentUser] = this.getRecords("mail.channel.member", [
+ const [memberOfCurrentUser] = this.getRecords("discuss.channel.member", [
["channel_id", "=", channel.id],
["partner_id", "=", this.currentPartnerId],
]);
@@ -431,26 +434,26 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
fold_state: foldState,
is_minimized: foldState !== "closed",
};
- this.pyEnv["mail.channel.member"].write([memberOfCurrentUser.id], vals);
+ this.pyEnv["discuss.channel.member"].write([memberOfCurrentUser.id], vals);
this.pyEnv["bus.bus"]._sendone(this.pyEnv.currentPartner, "mail.record/insert", {
Thread: {
id: channel.id,
- model: "mail.channel",
+ model: "discuss.channel",
serverFoldState: memberOfCurrentUser.fold_state,
},
});
}
},
/**
- * Simulates 'channel_create' on 'mail.channel'.
+ * Simulates 'channel_create' on 'discuss.channel'.
*
* @private
* @param {string} name
* @param {string} [group_id]
* @returns {Object}
*/
- _mockMailChannelChannelCreate(name, group_id) {
- const id = this.pyEnv["mail.channel"].create({
+ _mockDiscussChannelChannelCreate(name, group_id) {
+ const id = this.pyEnv["discuss.channel"].create({
channel_member_ids: [
[
0,
@@ -464,25 +467,25 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
name,
group_public_id: group_id,
});
- this.pyEnv["mail.channel"].write([id], {
+ this.pyEnv["discuss.channel"].write([id], {
group_public_id: group_id,
});
- this._mockMailChannelMessagePost(id, {
+ this._mockDiscussChannelMessagePost(id, {
body: `
`,
message_type: "notification",
});
- this._mockMailChannel_broadcast(id, [this.pyEnv.currentPartner]);
- return this._mockMailChannelChannelInfo([id])[0];
+ this._mockDiscussChannel_broadcast(id, [this.pyEnv.currentPartner]);
+ return this._mockDiscussChannelChannelInfo([id])[0];
},
/**
- * Simulates 'channel_get' on 'mail.channel'.
+ * Simulates 'channel_get' on 'discuss.channel'.
*
* @private
* @param {integer[]} [partners_to=[]]
* @param {boolean} [pin=true]
* @returns {Object}
*/
- _mockMailChannelChannelGet(partners_to = [], pin = true) {
+ _mockDiscussChannelChannelGet(partners_to = [], pin = true) {
if (partners_to.length === 0) {
return false;
}
@@ -490,9 +493,9 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
partners_to.push(this.currentPartnerId);
}
const partners = this.getRecords("res.partner", [["id", "in", partners_to]]);
- const channels = this.pyEnv["mail.channel"].searchRead([["channel_type", "=", "chat"]]);
+ const channels = this.pyEnv["discuss.channel"].searchRead([["channel_type", "=", "chat"]]);
for (const channel of channels) {
- const channelMemberIds = this.pyEnv["mail.channel.member"].search([
+ const channelMemberIds = this.pyEnv["discuss.channel.member"].search([
["channel_id", "=", channel.id],
["partner_id", "in", partners_to],
]);
@@ -500,10 +503,10 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
channelMemberIds.length === partners.length &&
channel.channel_member_ids.length === partners.length
) {
- return this._mockMailChannelChannelInfo([channel.id])[0];
+ return this._mockDiscussChannelChannelInfo([channel.id])[0];
}
}
- const id = this.pyEnv["mail.channel"].create({
+ const id = this.pyEnv["discuss.channel"].create({
channel_member_ids: partners.map((partner) => [
0,
0,
@@ -514,27 +517,27 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
channel_type: "chat",
name: partners.map((partner) => partner.name).join(", "),
});
- this._mockMailChannel_broadcast(
+ this._mockDiscussChannel_broadcast(
id,
partners.map(({ id }) => id)
);
- return this._mockMailChannelChannelInfo([id])[0];
+ return this._mockDiscussChannelChannelInfo([id])[0];
},
/**
- * Simulates `channel_info` on `mail.channel`.
+ * Simulates `channel_info` on `discuss.channel`.
*
* @private
* @param {integer[]} ids
* @returns {Object[]}
*/
- _mockMailChannelChannelInfo(ids) {
- const channels = this.getRecords("mail.channel", [["id", "in", ids]]);
+ _mockDiscussChannelChannelInfo(ids) {
+ const channels = this.getRecords("discuss.channel", [["id", "in", ids]]);
return channels.map((channel) => {
- const members = this.getRecords("mail.channel.member", [
+ const members = this.getRecords("discuss.channel.member", [
["id", "in", channel.channel_member_ids],
]);
const messages = this.getRecords("mail.message", [
- ["model", "=", "mail.channel"],
+ ["model", "=", "discuss.channel"],
["res_id", "=", channel.id],
]);
const [group_public_id] = this.getRecords("res.groups", [
@@ -555,7 +558,7 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
avatarCacheKey: channel.avatarCacheKey,
channel_type: channel.channel_type,
id: channel.id,
- memberCount: this.pyEnv["mail.channel.member"].searchCount([
+ memberCount: this.pyEnv["discuss.channel.member"].searchCount([
["channel_id", "=", channel.id],
]),
};
@@ -574,7 +577,7 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
message_needaction_counter: messageNeedactionCounter,
authorizedGroupFullName: group_public_id ? group_public_id.name : false,
});
- const [memberOfCurrentUser] = this.getRecords("mail.channel.member", [
+ const [memberOfCurrentUser] = this.getRecords("discuss.channel.member", [
["channel_id", "=", channel.id],
["partner_id", "=", this.currentPartnerId],
]);
@@ -599,7 +602,7 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
channelData["channelMembers"] = [
[
"insert",
- this._mockMailChannelMember_MailChannelMemberFormat([
+ this._mockDiscussChannelMember_DiscussChannelMemberFormat([
memberOfCurrentUser.id,
]),
],
@@ -618,7 +621,7 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
channelData["channelMembers"] = [
[
"insert",
- this._mockMailChannelMember_MailChannelMemberFormat(
+ this._mockDiscussChannelMember_DiscussChannelMemberFormat(
members.map((member) => member.id)
),
],
@@ -628,7 +631,9 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
[
"insert",
(channel.rtc_session_ids || []).map((rtcSessionId) =>
- this._mockMailChannelRtcSession_MailChannelRtcSessionFormat(rtcSessionId)
+ this._mockDiscussChannelRtcSession_DiscussChannelRtcSessionFormat(
+ rtcSessionId
+ )
),
],
];
@@ -637,52 +642,52 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
});
},
/**
- * Simulates the `channel_pin` method of `mail.channel`.
+ * Simulates the `channel_pin` method of `discuss.channel`.
*
* @private
* @param {number[]} ids
* @param {boolean} [pinned=false]
*/
- async _mockMailChannelChannelPin(ids, pinned = false) {
- const [channel] = this.getRecords("mail.channel", [["id", "in", ids]]);
- const [memberOfCurrentUser] = this.getRecords("mail.channel.member", [
+ async _mockDiscussChannelChannelPin(ids, pinned = false) {
+ const [channel] = this.getRecords("discuss.channel", [["id", "in", ids]]);
+ const [memberOfCurrentUser] = this.getRecords("discuss.channel.member", [
["channel_id", "=", channel.id],
["partner_id", "=", this.currentPartnerId],
["is_pinned", "!=", pinned],
]);
if (memberOfCurrentUser) {
- this.pyEnv["mail.channel.member"].write([memberOfCurrentUser.id], {
+ this.pyEnv["discuss.channel.member"].write([memberOfCurrentUser.id], {
is_pinned: pinned,
});
}
if (!pinned) {
- this.pyEnv["bus.bus"]._sendone(this.pyEnv.currentPartner, "mail.channel/unpin", {
+ this.pyEnv["bus.bus"]._sendone(this.pyEnv.currentPartner, "discuss.channel/unpin", {
id: channel.id,
});
} else {
this.pyEnv["bus.bus"]._sendone(
this.pyEnv.currentPartner,
- "mail.channel/legacy_insert",
- this._mockMailChannelChannelInfo([channel.id])[0]
+ "discuss.channel/legacy_insert",
+ this._mockDiscussChannelChannelInfo([channel.id])[0]
);
}
},
/**
- * Simulates the `_channel_seen` method of `mail.channel`.
+ * Simulates the `_channel_seen` method of `discuss.channel`.
*
* @private
* @param integer[] ids
* @param {integer} last_message_id
*/
- async _mockMailChannel_ChannelSeen(ids, last_message_id) {
+ async _mockDiscussChannel_ChannelSeen(ids, last_message_id) {
// Update record
const channel_id = ids[0];
if (!channel_id) {
throw new Error("Should only be one channel in channel_seen mock params");
}
- const channel = this.getRecords("mail.channel", [["id", "=", channel_id]])[0];
+ const channel = this.getRecords("discuss.channel", [["id", "=", channel_id]])[0];
const messages = this.getRecords("mail.message", [
- ["model", "=", "mail.channel"],
+ ["model", "=", "discuss.channel"],
["res_id", "=", channel.id],
]);
if (!messages || messages.length === 0) {
@@ -691,10 +696,10 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
if (!channel) {
return;
}
- this._mockMailChannel_SetLastSeenMessage([channel.id], last_message_id);
+ this._mockDiscussChannel_SetLastSeenMessage([channel.id], last_message_id);
this.pyEnv["bus.bus"]._sendone(
channel.channel_type === "chat" ? channel : this.pyEnv.currentPartner,
- "mail.channel.member/seen",
+ "discuss.channel.member/seen",
{
channel_id: channel.id,
last_message_id: last_message_id,
@@ -703,46 +708,46 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
);
},
/**
- * Simulates `channel_rename` on `mail.channel`.
+ * Simulates `channel_rename` on `discuss.channel`.
*
* @private
* @param {integer[]} ids
*/
- _mockMailChannelChannelRename(ids, name) {
- const channel = this.getRecords("mail.channel", [["id", "in", ids]])[0];
- this.pyEnv["mail.channel"].write([channel.id], { name });
+ _mockDiscussChannelChannelRename(ids, name) {
+ const channel = this.getRecords("discuss.channel", [["id", "in", ids]])[0];
+ this.pyEnv["discuss.channel"].write([channel.id], { name });
this.pyEnv["bus.bus"]._sendone(channel, "mail.record/insert", {
Thread: {
id: channel.id,
- model: "mail.channel",
+ model: "discuss.channel",
name: name,
},
});
},
- _mockMailChannelChannelChangeDescription(ids, description) {
- const channel = this.getRecords("mail.channel", [["id", "in", ids]])[0];
- this.pyEnv["mail.channel"].write([channel.id], { description });
+ _mockDiscussChannelChannelChangeDescription(ids, description) {
+ const channel = this.getRecords("discuss.channel", [["id", "in", ids]])[0];
+ this.pyEnv["discuss.channel"].write([channel.id], { description });
this.pyEnv["bus.bus"]._sendone(channel, "mail.record/insert", {
Thread: {
id: channel.id,
- model: "mail.channel",
+ model: "discuss.channel",
description: description,
},
});
},
/**
- * Simulates `channel_set_custom_name` on `mail.channel`.
+ * Simulates `channel_set_custom_name` on `discuss.channel`.
*
* @private
* @param {integer[]} ids
*/
- _mockMailChannelChannelSetCustomName(ids, name) {
+ _mockDiscussChannelChannelSetCustomName(ids, name) {
const channelId = ids[0]; // simulate ensure_one.
- const [memberIdOfCurrentUser] = this.pyEnv["mail.channel.member"].search([
+ const [memberIdOfCurrentUser] = this.pyEnv["discuss.channel.member"].search([
["partner_id", "=", this.currentPartnerId],
["channel_id", "=", channelId],
]);
- this.pyEnv["mail.channel.member"].write([memberIdOfCurrentUser], {
+ this.pyEnv["discuss.channel.member"].write([memberIdOfCurrentUser], {
custom_channel_name: name,
});
this.pyEnv["bus.bus"]._sendone(this.pyEnv.currentPartner, "mail.record/insert", {
@@ -753,48 +758,48 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
});
},
/**
- * Simulates the `create_group` on `mail.channel`.
+ * Simulates the `create_group` on `discuss.channel`.
*
* @private
* @param {integer[]} partners_to
* @returns {Object}
*/
- async _mockMailChannelCreateGroup(partners_to) {
+ async _mockDiscussChannelCreateGroup(partners_to) {
const partners = this.getRecords("res.partner", [["id", "in", partners_to]]);
- const id = this.pyEnv["mail.channel"].create({
+ const id = this.pyEnv["discuss.channel"].create({
channel_type: "group",
channel_member_ids: partners.map((partner) => [0, 0, { partner_id: partner.id }]),
name: "",
});
- this._mockMailChannel_broadcast(
+ this._mockDiscussChannel_broadcast(
id,
partners.map((partner) => partner.id)
);
- return this._mockMailChannelChannelInfo([id])[0];
+ return this._mockDiscussChannelChannelInfo([id])[0];
},
/**
- * Simulates `execute_command_leave` on `mail.channel`.
+ * Simulates `execute_command_leave` on `discuss.channel`.
*
* @private
*/
- _mockMailChannelExecuteCommandLeave(args) {
- const channel = this.getRecords("mail.channel", [["id", "in", args.args[0]]])[0];
+ _mockDiscussChannelExecuteCommandLeave(args) {
+ const channel = this.getRecords("discuss.channel", [["id", "in", args.args[0]]])[0];
if (channel.channel_type === "channel") {
- this._mockMailChannelActionUnfollow([channel.id]);
+ this._mockDiscussChannelActionUnfollow([channel.id]);
} else {
- this._mockMailChannelChannelPin([channel.id], false);
+ this._mockDiscussChannelChannelPin([channel.id], false);
}
},
/**
- * Simulates `execute_command_who` on `mail.channel`.
+ * Simulates `execute_command_who` on `discuss.channel`.
*
* @private
*/
- _mockMailChannelExecuteCommandWho(args) {
+ _mockDiscussChannelExecuteCommandWho(args) {
const ids = args.args[0];
- const channels = this.getRecords("mail.channel", [["id", "in", ids]]);
+ const channels = this.getRecords("discuss.channel", [["id", "in", ids]]);
for (const channel of channels) {
- const members = this.getRecords("mail.channel.member", [
+ const members = this.getRecords("discuss.channel.member", [
["id", "in", channel.channel_member_ids],
]);
const otherPartnerIds = members
@@ -811,22 +816,22 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
}
this.pyEnv["bus.bus"]._sendone(
this.pyEnv.currentPartner,
- "mail.channel/transient_message",
+ "discuss.channel/transient_message",
{
body: `
${message}`,
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channel.id,
}
);
}
},
/**
- * Simulates `get_mention_suggestions` on `mail.channel`.
+ * Simulates `get_mention_suggestions` on `discuss.channel`.
*
* @private
* @returns {Array[]}
*/
- _mockMailChannelGetMentionSuggestions(args) {
+ _mockDiscussChannelGetMentionSuggestions(args) {
const search = args.kwargs.search || "";
const limit = args.kwargs.limit || 8;
@@ -874,7 +879,7 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
};
const mentionSuggestions = mentionSuggestionsFilter(
- this.models["mail.channel"].records,
+ this.models["discuss.channel"].records,
search,
limit
);
@@ -882,15 +887,15 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
return mentionSuggestions;
},
/**
- * Simulates `write` on `mail.channel` when `image_128` changes.
+ * Simulates `write` on `discuss.channel` when `image_128` changes.
*
* @param {integer} id
*/
- _mockMailChannelWriteImage128(id) {
- this.pyEnv["mail.channel"].write([id], {
+ _mockDiscussChannelWriteImage128(id) {
+ this.pyEnv["discuss.channel"].write([id], {
avatarCacheKey: moment.utc().format("YYYYMMDDHHmmss"),
});
- const channel = this.pyEnv["mail.channel"].searchRead([["id", "=", id]])[0];
+ const channel = this.pyEnv["discuss.channel"].searchRead([["id", "=", id]])[0];
this.pyEnv["bus.bus"]._sendone(channel, "mail.record/insert", {
Channel: {
avatarCacheKey: channel.avatarCacheKey,
@@ -899,21 +904,21 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
});
},
/**
- * Simulates `load_more_members` on `mail.channel`.
+ * Simulates `load_more_members` on `discuss.channel`.
*
* @private
* @param {integer[]} channel_ids
* @param {integer[]} known_member_ids
*/
- _mockMailChannelloadOlderMembers(channel_ids, known_member_ids) {
- const members = this.pyEnv["mail.channel.member"].searchRead(
+ _mockDiscussChannelloadOlderMembers(channel_ids, known_member_ids) {
+ const members = this.pyEnv["discuss.channel.member"].searchRead(
[
["id", "not in", known_member_ids],
["channel_id", "in", channel_ids],
],
{ limit: 100 }
);
- const memberCount = this.pyEnv["mail.channel.member"].searchCount([
+ const memberCount = this.pyEnv["discuss.channel.member"].searchCount([
["channel_id", "in", channel_ids],
]);
const membersData = [];
@@ -955,19 +960,19 @@ patch(MockServer.prototype, "mail/models/mail_channel", {
};
},
/**
- * Simulates the `_set_last_seen_message` method of `mail.channel`.
+ * Simulates the `_set_last_seen_message` method of `discuss.channel`.
*
* @private
* @param {integer[]} ids
* @param {integer} message_id
*/
- _mockMailChannel_SetLastSeenMessage(ids, message_id) {
- const [memberOfCurrentUser] = this.getRecords("mail.channel.member", [
+ _mockDiscussChannel_SetLastSeenMessage(ids, message_id) {
+ const [memberOfCurrentUser] = this.getRecords("discuss.channel.member", [
["channel_id", "in", ids],
["partner_id", "=", this.currentPartnerId],
]);
if (memberOfCurrentUser) {
- this.pyEnv["mail.channel.member"].write([memberOfCurrentUser.id], {
+ this.pyEnv["discuss.channel.member"].write([memberOfCurrentUser.id], {
fetched_message_id: message_id,
seen_message_id: message_id,
});
diff --git a/addons/mail/static/tests/helpers/mock_server/models/mail_channel_member.js b/addons/mail/static/tests/helpers/mock_server/models/discuss_channel_member.js
similarity index 55%
rename from addons/mail/static/tests/helpers/mock_server/models/mail_channel_member.js
rename to addons/mail/static/tests/helpers/mock_server/models/discuss_channel_member.js
index 8776ec0fcd7..628cbda0a73 100644
--- a/addons/mail/static/tests/helpers/mock_server/models/mail_channel_member.js
+++ b/addons/mail/static/tests/helpers/mock_server/models/discuss_channel_member.js
@@ -3,42 +3,42 @@
import { patch } from "@web/core/utils/patch";
import { MockServer } from "@web/../tests/helpers/mock_server";
-patch(MockServer.prototype, "mail/models/mail_channel_member", {
+patch(MockServer.prototype, "mail/models/discuss_channel_member", {
/**
- * Simulates `notify_typing` on `mail.channel.member`.
+ * Simulates `notify_typing` on `discuss.channel.member`.
*
* @private
* @param {integer[]} ids
* @param {boolean} is_typing
*/
- _mockMailChannelMember_NotifyTyping(ids, is_typing) {
- const members = this.getRecords("mail.channel.member", [["id", "in", ids]]);
+ _mockDiscussChannelMember_NotifyTyping(ids, is_typing) {
+ const members = this.getRecords("discuss.channel.member", [["id", "in", ids]]);
const notifications = [];
for (const member of members) {
- const [channel] = this.getRecords("mail.channel", [["id", "=", member.channel_id]]);
- const [data] = this._mockMailChannelMember_MailChannelMemberFormat([member.id]);
+ const [channel] = this.getRecords("discuss.channel", [["id", "=", member.channel_id]]);
+ const [data] = this._mockDiscussChannelMember_DiscussChannelMemberFormat([member.id]);
Object.assign(data, {
isTyping: is_typing,
});
- notifications.push([channel, "mail.channel.member/typing_status", data]);
- notifications.push([channel.uuid, "mail.channel.member/typing_status", data]);
+ notifications.push([channel, "discuss.channel.member/typing_status", data]);
+ notifications.push([channel.uuid, "discuss.channel.member/typing_status", data]);
}
this.pyEnv["bus.bus"]._sendmany(notifications);
},
/**
- * Simulates `_mail_channel_member_format` on `mail.channel.member`.
+ * Simulates `_discuss_channel_member_format` on `discuss.channel.member`.
*
* @private
* @param {integer[]} ids
* @returns {Object[]}
*/
- _mockMailChannelMember_MailChannelMemberFormat(ids) {
- const members = this.getRecords("mail.channel.member", [["id", "in", ids]]);
+ _mockDiscussChannelMember_DiscussChannelMemberFormat(ids) {
+ const members = this.getRecords("discuss.channel.member", [["id", "in", ids]]);
const dataList = [];
for (const member of members) {
let persona;
if (member.partner_id) {
- persona = { partner: this._mockMailChannelMember_GetPartnerData([member.id]) };
+ persona = { partner: this._mockDiscussChannelMember_GetPartnerData([member.id]) };
}
if (member.guest_id) {
const [guest] = this.getRecords("mail.guest", [["id", "=", member.guest_id]]);
@@ -60,14 +60,14 @@ patch(MockServer.prototype, "mail/models/mail_channel_member", {
return dataList;
},
/**
- * Simulates `_get_partner_data` on `mail.channel.member`.
+ * Simulates `_get_partner_data` on `discuss.channel.member`.
*
* @private
* @param {integer[]} ids
* @returns {Object}
*/
- _mockMailChannelMember_GetPartnerData(ids) {
- const [member] = this.getRecords("mail.channel.member", [["id", "in", ids]]);
+ _mockDiscussChannelMember_GetPartnerData(ids) {
+ const [member] = this.getRecords("discuss.channel.member", [["id", "in", ids]]);
return this._mockResPartnerMailPartnerFormat([member.partner_id]).get(member.partner_id);
},
});
diff --git a/addons/mail/static/tests/helpers/mock_server/models/mail_channel_rtc_session.js b/addons/mail/static/tests/helpers/mock_server/models/discuss_channel_rtc_session.js
similarity index 55%
rename from addons/mail/static/tests/helpers/mock_server/models/mail_channel_rtc_session.js
rename to addons/mail/static/tests/helpers/mock_server/models/discuss_channel_rtc_session.js
index 94c61056551..ba3114734b2 100644
--- a/addons/mail/static/tests/helpers/mock_server/models/mail_channel_rtc_session.js
+++ b/addons/mail/static/tests/helpers/mock_server/models/discuss_channel_rtc_session.js
@@ -3,19 +3,19 @@
import { patch } from "@web/core/utils/patch";
import { MockServer } from "@web/../tests/helpers/mock_server";
-patch(MockServer.prototype, "mail/models/mail_channel_rtc_session", {
+patch(MockServer.prototype, "mail/models/discuss_channel_rtc_session", {
/**
- * Simulates `_mail_rtc_session_format` on `mail.channel.rtc.session`.
+ * Simulates `_mail_rtc_session_format` on `discuss.channel.rtc.session`.
*
* @private
* @param {integer} id
* @returns {Object}
*/
- _mockMailChannelRtcSession_MailChannelRtcSessionFormat(id) {
- const [rtcSession] = this.getRecords("mail.channel.rtc.session", [["id", "=", id]]);
+ _mockDiscussChannelRtcSession_DiscussChannelRtcSessionFormat(id) {
+ const [rtcSession] = this.getRecords("discuss.channel.rtc.session", [["id", "=", id]]);
return {
id: rtcSession.id,
- channelMember: this._mockMailChannelMember_MailChannelMemberFormat([
+ channelMember: this._mockDiscussChannelMember_DiscussChannelMemberFormat([
rtcSession.channel_member_id,
])[0],
isCameraOn: rtcSession.is_camera_on,
@@ -25,21 +25,21 @@ patch(MockServer.prototype, "mail/models/mail_channel_rtc_session", {
};
},
/**
- * Simulates `_mail_rtc_session_format` on `mail.channel.rtc.session`.
+ * Simulates `_mail_rtc_session_format` on `discuss.channel.rtc.session`.
*
* @private
* @param {integer[]} ids
* @returns {Object}
*/
- _mockMailChannelRtcSession_MailChannelRtcSessionFormatByChannel(ids) {
- const rtcSessions = this.getRecords("mail.channel.rtc.session", [["id", "in", ids]]);
+ _mockDiscussChannelRtcSession_DiscussChannelRtcSessionFormatByChannel(ids) {
+ const rtcSessions = this.getRecords("discuss.channel.rtc.session", [["id", "in", ids]]);
const data = {};
for (const rtcSession of rtcSessions) {
if (!data[rtcSession.channel_id]) {
data[rtcSession.channel_id] = [];
}
data[rtcSession.channel_id].push(
- this._mockMailChannelRtcSession_MailChannelRtcSessionFormat(rtcSession.id)
+ this._mockDiscussChannelRtcSession_DiscussChannelRtcSessionFormat(rtcSession.id)
);
}
return data;
diff --git a/addons/mail/static/tests/helpers/mock_server/models/mail_thread.js b/addons/mail/static/tests/helpers/mock_server/models/mail_thread.js
index abc8d11a868..9f14ddda458 100644
--- a/addons/mail/static/tests/helpers/mock_server/models/mail_thread.js
+++ b/addons/mail/static/tests/helpers/mock_server/models/mail_thread.js
@@ -249,16 +249,16 @@ patch(MockServer.prototype, "mail/models/mail_thread", {
const message = this.getRecords("mail.message", [["id", "=", messageId]])[0];
const messageFormat = this._mockMailMessageMessageFormat([messageId])[0];
const notifications = [];
- if (model === "mail.channel") {
+ if (model === "discuss.channel") {
// members
- const channels = this.getRecords("mail.channel", [["id", "=", message.res_id]]);
+ const channels = this.getRecords("discuss.channel", [["id", "=", message.res_id]]);
for (const channel of channels) {
// notify update of last_interest_dt
const now = datetime_to_str(new Date());
- const members = this.getRecords("mail.channel.member", [
+ const members = this.getRecords("discuss.channel.member", [
["id", "in", channel.channel_member_ids],
]);
- this.pyEnv["mail.channel.member"].write(
+ this.pyEnv["discuss.channel.member"].write(
members.map((member) => member.id),
{ last_interest_dt: now }
);
@@ -266,7 +266,7 @@ patch(MockServer.prototype, "mail/models/mail_thread", {
// simplification, send everything on the current user "test" bus, but it should send to each member instead
notifications.push([
member,
- "mail.channel/last_interest_dt_changed",
+ "discuss.channel/last_interest_dt_changed",
{
id: channel.id,
isServerPinned: member.is_pinned,
@@ -276,18 +276,18 @@ patch(MockServer.prototype, "mail/models/mail_thread", {
}
notifications.push([
channel,
- "mail.channel/new_message",
+ "discuss.channel/new_message",
{
id: channel.id,
message: Object.assign(messageFormat, { temporary_id }),
},
]);
if (message.author_id === this.currentPartnerId) {
- this._mockMailChannel_ChannelSeen(ids, message.id);
+ this._mockDiscussChannel_ChannelSeen(ids, message.id);
}
}
}
- const channelMemberOfCurrentUser = this.pyEnv["mail.channel.member"].search([
+ const channelMemberOfCurrentUser = this.pyEnv["discuss.channel.member"].search([
["channel_id", "=", message.res_id],
["partner_id", "=", this.currentPartnerId],
]);
diff --git a/addons/mail/static/tests/helpers/mock_server/models/res_partner.js b/addons/mail/static/tests/helpers/mock_server/models/res_partner.js
index 09ef8996cea..a8e215dce37 100644
--- a/addons/mail/static/tests/helpers/mock_server/models/res_partner.js
+++ b/addons/mail/static/tests/helpers/mock_server/models/res_partner.js
@@ -51,7 +51,7 @@ patch(MockServer.prototype, "mail/models/res_partner", {
partners
.filter((partner) => {
if (channel_id) {
- const [member] = this.getRecords("mail.channel.member", [
+ const [member] = this.getRecords("discuss.channel.member", [
["channel_id", "=", channel_id],
["partner_id", "=", partner.id],
]);
@@ -76,7 +76,7 @@ patch(MockServer.prototype, "mail/models/res_partner", {
).values(),
].map((partnerFormat) => {
if (channel_id) {
- const [member] = this.getRecords("mail.channel.member", [
+ const [member] = this.getRecords("discuss.channel.member", [
["channel_id", "=", channel_id],
["partner_id", "=", partnerFormat.id],
]);
@@ -84,7 +84,9 @@ patch(MockServer.prototype, "mail/models/res_partner", {
channelMembers: [
[
"insert",
- this._mockMailChannelMember_MailChannelMemberFormat([member.id]),
+ this._mockDiscussChannelMember_DiscussChannelMemberFormat([
+ member.id,
+ ]),
],
],
};
@@ -302,18 +304,18 @@ patch(MockServer.prototype, "mail/models/res_partner", {
*/
_mockResPartner_GetChannelsAsMember(ids) {
const partner = this.getRecords("res.partner", [["id", "in", ids]])[0];
- const channelMembers = this.getRecords("mail.channel.member", [
+ const channelMembers = this.getRecords("discuss.channel.member", [
["partner_id", "=", partner.id],
]);
- const channels = this.getRecords("mail.channel", [
+ const channels = this.getRecords("discuss.channel", [
["channel_type", "in", ["channel", "group"]],
["channel_member_ids", "in", channelMembers.map((member) => member.id)],
]);
- const directMessagesMembers = this.getRecords("mail.channel.member", [
+ const directMessagesMembers = this.getRecords("discuss.channel.member", [
["partner_id", "=", partner.id],
["is_pinned", "=", true],
]);
- const directMessages = this.getRecords("mail.channel", [
+ const directMessages = this.getRecords("discuss.channel", [
["channel_type", "=", "chat"],
["channel_member_ids", "in", directMessagesMembers.map((member) => member.id)],
]);
diff --git a/addons/mail/static/tests/helpers/mock_server/models/res_users.js b/addons/mail/static/tests/helpers/mock_server/models/res_users.js
index 67ec8bf3c73..3f579b58796 100644
--- a/addons/mail/static/tests/helpers/mock_server/models/res_users.js
+++ b/addons/mail/static/tests/helpers/mock_server/models/res_users.js
@@ -23,7 +23,7 @@ patch(MockServer.prototype, "mail/models/res_users", {
const user = this.getRecords("res.users", [["id", "in", ids]])[0];
const userSettings = this._mockResUsersSettings_FindOrCreateForUser(user.id);
return {
- channels: this._mockMailChannelChannelInfo(
+ channels: this._mockDiscussChannelChannelInfo(
this._mockResPartner_GetChannelsAsMember(user.partner_id).map(
(channel) => channel.id
)
diff --git a/addons/mail/static/tests/helpers/model_definitions_setup.js b/addons/mail/static/tests/helpers/model_definitions_setup.js
index 5de0ab2517d..6cdd83a39fd 100644
--- a/addons/mail/static/tests/helpers/model_definitions_setup.js
+++ b/addons/mail/static/tests/helpers/model_definitions_setup.js
@@ -15,9 +15,9 @@ import {
addModelNamesToFetch([
"mail.activity",
"mail.activity.type",
- "mail.channel",
- "mail.channel.member",
- "mail.channel.rtc.session",
+ "discuss.channel",
+ "discuss.channel.member",
+ "discuss.channel.rtc.session",
"mail.followers",
"mail.guest",
"mail.link.preview",
@@ -52,7 +52,7 @@ addFakeModel("m2x.avatar.user", {
insertModelFields("mail.activity", {
chaining_type: { default: "suggest" },
});
-insertModelFields("mail.channel", {
+insertModelFields("discuss.channel", {
author_id: {
default() {
return this.currentPartnerId;
@@ -71,9 +71,9 @@ insertModelFields("mail.channel", {
return TEST_GROUP_IDS.groupUserId;
},
},
- uuid: { default: () => _.uniqueId("mail.channel_uuid-") },
+ uuid: { default: () => _.uniqueId("discuss.channel_uuid-") },
});
-insertModelFields("mail.channel.member", {
+insertModelFields("discuss.channel.member", {
fold_state: { default: "open" },
is_pinned: { default: true },
message_unread_counter: { default: 0 },
diff --git a/addons/mail/static/tests/helpers/test_utils.js b/addons/mail/static/tests/helpers/test_utils.js
index d1585713a9f..b3ff09c4b0a 100644
--- a/addons/mail/static/tests/helpers/test_utils.js
+++ b/addons/mail/static/tests/helpers/test_utils.js
@@ -161,8 +161,8 @@ function getOpenDiscuss(webClient, { context = {}, params = {}, ...props } = {})
const activeId =
pActiveId ?? context.active_id ?? params.default_active_id ?? "mail.box_inbox";
let [threadModel, threadId] =
- typeof activeId === "number" ? ["mail.channel", activeId] : activeId.split("_");
- if (threadModel === "mail.channel") {
+ typeof activeId === "number" ? ["discuss.channel", activeId] : activeId.split("_");
+ if (threadModel === "discuss.channel") {
threadId = parseInt(threadId, 10);
}
// TODO-DISCUSS-REFACTORING: remove when activeId will be handled.
@@ -181,7 +181,7 @@ function getOpenDiscuss(webClient, { context = {}, params = {}, ...props } = {})
}
let loadMessageRoute = `/mail/${threadId}/messages`;
if (Number.isInteger(threadId)) {
- loadMessageRoute = "/mail/channel/messages";
+ loadMessageRoute = "/discuss/channel/messages";
}
registry.category("mock_server_callbacks").add(
loadMessageRoute,
diff --git a/addons/mail/static/tests/helpers/webclient_setup.js b/addons/mail/static/tests/helpers/webclient_setup.js
index 129ebc1112a..f2bb9c30be5 100644
--- a/addons/mail/static/tests/helpers/webclient_setup.js
+++ b/addons/mail/static/tests/helpers/webclient_setup.js
@@ -119,7 +119,7 @@ export const setupManager = {
"bus.parameters": busParametersService,
im_status: imStatusService,
effect: effectService,
- "mail.channel.member": channelMemberService,
+ "discuss.channel.member": channelMemberService,
"mail.context": contextService,
"mail.notification.permission": notificationPermissionService,
"mail.suggestion": suggestionService,
diff --git a/addons/mail/static/tests/message/link_preview_test.js b/addons/mail/static/tests/message/link_preview_test.js
index cd70ec1284f..129b610b116 100644
--- a/addons/mail/static/tests/message/link_preview_test.js
+++ b/addons/mail/static/tests/message/link_preview_test.js
@@ -14,12 +14,12 @@ QUnit.test("auto layout with link preview list", async (assert) => {
og_type: "video.other",
source_url: "https://tenor.com/view/yay-minions-happiness-happy-excited-gif-15324023",
});
- const channelId = pyEnv["mail.channel"].create({ name: "wololo" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "wololo" });
pyEnv["mail.message"].create({
body: "not empty",
link_preview_ids: [linkPreviewId],
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -37,12 +37,12 @@ QUnit.test("auto layout with link preview as gif", async (assert) => {
og_type: "video.other",
source_url: "https://tenor.com/view/yay-minions-happiness-happy-excited-gif-15324023",
});
- const channelId = pyEnv["mail.channel"].create({ name: "wololo" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "wololo" });
pyEnv["mail.message"].create({
body: "not empty",
link_preview_ids: [linkPreviewId],
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -58,12 +58,12 @@ QUnit.test("simplest card layout", async (assert) => {
og_type: "article",
source_url: "https://www.odoo.com",
});
- const channelId = pyEnv["mail.channel"].create({ name: "wololo" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "wololo" });
pyEnv["mail.message"].create({
body: "not empty",
link_preview_ids: [linkPreviewId],
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -82,12 +82,12 @@ QUnit.test("simplest card layout with image", async (assert) => {
og_type: "article",
source_url: "https://www.odoo.com",
});
- const channelId = pyEnv["mail.channel"].create({ name: "wololo" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "wololo" });
pyEnv["mail.message"].create({
body: "not empty",
link_preview_ids: [linkPreviewId],
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -107,12 +107,12 @@ QUnit.test("Link preview video layout", async (assert) => {
og_type: "video.other",
source_url: "https://www.odoo.com",
});
- const channelId = pyEnv["mail.channel"].create({ name: "wololo" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "wololo" });
pyEnv["mail.message"].create({
body: "not empty",
link_preview_ids: [linkPreviewId],
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -130,12 +130,12 @@ QUnit.test("Link preview image layout", async (assert) => {
source_url:
"https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Siberischer_tiger_de_edit02.jpg/290px-Siberischer_tiger_de_edit02.jpg",
});
- const channelId = pyEnv["mail.channel"].create({ name: "wololo" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "wololo" });
pyEnv["mail.message"].create({
body: "not empty",
link_preview_ids: [linkPreviewId],
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -153,12 +153,12 @@ QUnit.test("Remove link preview Gif", async (assert) => {
og_type: "video.other",
source_url: "https://tenor.com/view/yay-minions-happiness-happy-excited-gif-15324023",
});
- const channelId = pyEnv["mail.channel"].create({ name: "wololo" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "wololo" });
pyEnv["mail.message"].create({
body: "not empty",
link_preview_ids: [linkPreviewId],
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -177,12 +177,12 @@ QUnit.test("Remove link preview card", async (assert) => {
og_type: "article",
source_url: "https://www.odoo.com",
});
- const channelId = pyEnv["mail.channel"].create({ name: "wololo" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "wololo" });
pyEnv["mail.message"].create({
body: "not empty",
link_preview_ids: [linkPreviewId],
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -202,12 +202,12 @@ QUnit.test("Remove link preview video", async (assert) => {
og_type: "video.other",
source_url: "https://www.odoo.com",
});
- const channelId = pyEnv["mail.channel"].create({ name: "wololo" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "wololo" });
pyEnv["mail.message"].create({
body: "not empty",
link_preview_ids: [linkPreviewId],
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -225,12 +225,12 @@ QUnit.test("Remove link preview image", async (assert) => {
source_url:
"https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Siberischer_tiger_de_edit02.jpg/290px-Siberischer_tiger_de_edit02.jpg",
});
- const channelId = pyEnv["mail.channel"].create({ name: "wololo" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "wololo" });
pyEnv["mail.message"].create({
body: "not empty",
link_preview_ids: [linkPreviewId],
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -248,12 +248,12 @@ QUnit.test("No crash on receiving link preview of non-known message", async (ass
source_url:
"https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Siberischer_tiger_de_edit02.jpg/290px-Siberischer_tiger_de_edit02.jpg",
});
- const channelId = pyEnv["mail.channel"].create({ name: "wololo" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "wololo" });
const messageId = pyEnv["mail.message"].create({
body: "https://make-link-preview.com",
link_preview_ids: [linkPreviewId],
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { env, openDiscuss } = await start();
@@ -272,12 +272,12 @@ QUnit.test(
source_url:
"https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Siberischer_tiger_de_edit02.jpg/290px-Siberischer_tiger_de_edit02.jpg",
});
- const channelId = pyEnv["mail.channel"].create({ name: "wololo" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "wololo" });
pyEnv["mail.message"].create({
body: "
http://linkPreview",
link_preview_ids: [linkPreviewId],
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -296,12 +296,12 @@ QUnit.test(
og_type: "article",
source_url: "https://www.odoo.com",
});
- const channelId = pyEnv["mail.channel"].create({ name: "wololo" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "wololo" });
pyEnv["mail.message"].create({
body: "
http://linkPreview",
link_preview_ids: [linkPreviewId],
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -319,12 +319,12 @@ QUnit.test(
source_url:
"https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Siberischer_tiger_de_edit02.jpg/290px-Siberischer_tiger_de_edit02.jpg",
});
- const channelId = pyEnv["mail.channel"].create({ name: "wololo" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "wololo" });
pyEnv["mail.message"].create({
body: "
http://linkPreview not empty",
link_preview_ids: [linkPreviewId],
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
diff --git a/addons/mail/static/tests/message/message_reply_tests.js b/addons/mail/static/tests/message/message_reply_tests.js
index a0a2b0c55f2..fb7010f4743 100644
--- a/addons/mail/static/tests/message/message_reply_tests.js
+++ b/addons/mail/static/tests/message/message_reply_tests.js
@@ -8,17 +8,17 @@ QUnit.module("message reply");
QUnit.test("click on message in reply to highlight the parent message", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const messageId = pyEnv["mail.message"].create({
body: "Hey lol",
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
pyEnv["mail.message"].create({
body: "Reply to Hey",
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
parent_id: messageId,
res_id: channelId,
});
@@ -36,21 +36,21 @@ QUnit.test("click on message in reply to scroll to the parent message", async (a
},
});
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const [oldestMessageId] = pyEnv["mail.message"].create(
Array(20)
.fill(0)
.map(() => ({
body: "Non Empty Body ".repeat(25),
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
}))
);
pyEnv["mail.message"].create({
body: "Response to first message",
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
parent_id: oldestMessageId,
res_id: channelId,
});
@@ -65,18 +65,18 @@ QUnit.test("click on message in reply to scroll to the parent message", async (a
QUnit.test("reply shows correct author avatar", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const messageId = pyEnv["mail.message"].create({
body: "Hey there",
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const partnerId = pyEnv["res.partner"].create({ name: "John Doe" });
pyEnv["mail.message"].create({
body: "Howdy",
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
author_id: partnerId,
parent_id: messageId,
res_id: channelId,
@@ -86,7 +86,7 @@ QUnit.test("reply shows correct author avatar", async (assert) => {
const replyAvatar = document.querySelector(".o-mail-MessageInReply-avatar");
assert.ok(
replyAvatar.dataset["src"].includes(
- `/mail/channel/${channelId}/partner/${pyEnv.currentPartnerId}/avatar_128`
+ `/discuss/channel/${channelId}/partner/${pyEnv.currentPartnerId}/avatar_128`
)
);
});
diff --git a/addons/mail/static/tests/message/message_seen_indicator_tests.js b/addons/mail/static/tests/message/message_seen_indicator_tests.js
index 9513aefa90b..abc4dc34c17 100644
--- a/addons/mail/static/tests/message/message_seen_indicator_tests.js
+++ b/addons/mail/static/tests/message/message_seen_indicator_tests.js
@@ -8,7 +8,7 @@ QUnit.test("rendering when just one has received the message", async (assert) =>
const pyEnv = await startServer();
const partnerId_1 = pyEnv["res.partner"].create({ name: "Demo User" });
const partnerId_2 = pyEnv["res.partner"].create({ name: "Other User" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -20,14 +20,14 @@ QUnit.test("rendering when just one has received the message", async (assert) =>
const messageId = pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
- const [memberId_1] = pyEnv["mail.channel.member"].search([
+ const [memberId_1] = pyEnv["discuss.channel.member"].search([
["channel_id", "=", channelId],
["partner_id", "=", partnerId_1],
]);
- pyEnv["mail.channel.member"].write([memberId_1], {
+ pyEnv["discuss.channel.member"].write([memberId_1], {
fetched_message_id: messageId,
seen_message_id: false,
});
@@ -42,7 +42,7 @@ QUnit.test("rendering when everyone have received the message", async (assert) =
const pyEnv = await startServer();
const partnerId_1 = pyEnv["res.partner"].create({ name: "Demo User" });
const partnerId_2 = pyEnv["res.partner"].create({ name: "Other User" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -54,11 +54,11 @@ QUnit.test("rendering when everyone have received the message", async (assert) =
const messageId = pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
- const memberIds = pyEnv["mail.channel.member"].search([["channel_id", "=", channelId]]);
- pyEnv["mail.channel.member"].write(memberIds, {
+ const memberIds = pyEnv["discuss.channel.member"].search([["channel_id", "=", channelId]]);
+ pyEnv["discuss.channel.member"].write(memberIds, {
fetched_message_id: messageId,
seen_message_id: false,
});
@@ -73,7 +73,7 @@ QUnit.test("rendering when just one has seen the message", async (assert) => {
const pyEnv = await startServer();
const partnerId_1 = pyEnv["res.partner"].create({ name: "Demo User" });
const partnerId_2 = pyEnv["res.partner"].create({ name: "Other User" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -85,19 +85,19 @@ QUnit.test("rendering when just one has seen the message", async (assert) => {
const messageId = pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
- const memberIds = pyEnv["mail.channel.member"].search([["channel_id", "=", channelId]]);
- pyEnv["mail.channel.member"].write(memberIds, {
+ const memberIds = pyEnv["discuss.channel.member"].search([["channel_id", "=", channelId]]);
+ pyEnv["discuss.channel.member"].write(memberIds, {
fetched_message_id: messageId,
seen_message_id: false,
});
- const [memberId_1] = pyEnv["mail.channel.member"].search([
+ const [memberId_1] = pyEnv["discuss.channel.member"].search([
["channel_id", "=", channelId],
["partner_id", "=", partnerId_1],
]);
- pyEnv["mail.channel.member"].write([memberId_1], {
+ pyEnv["discuss.channel.member"].write([memberId_1], {
seen_message_id: messageId,
});
const { openDiscuss } = await start();
@@ -111,7 +111,7 @@ QUnit.test("rendering when just one has seen & received the message", async (ass
const pyEnv = await startServer();
const partnerId_1 = pyEnv["res.partner"].create({ name: "Demo User" });
const partnerId_2 = pyEnv["res.partner"].create({ name: "Other User" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -123,14 +123,14 @@ QUnit.test("rendering when just one has seen & received the message", async (ass
const mesageId = pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
- const [memberId_1] = pyEnv["mail.channel.member"].search([
+ const [memberId_1] = pyEnv["discuss.channel.member"].search([
["channel_id", "=", channelId],
["partner_id", "=", partnerId_1],
]);
- pyEnv["mail.channel.member"].write([memberId_1], {
+ pyEnv["discuss.channel.member"].write([memberId_1], {
seen_message_id: mesageId,
fetched_message_id: mesageId,
});
@@ -145,7 +145,7 @@ QUnit.test("rendering when just everyone has seen the message", async (assert) =
const pyEnv = await startServer();
const partnerId_1 = pyEnv["res.partner"].create({ name: "Demo User" });
const partnerId_2 = pyEnv["res.partner"].create({ name: "Other User" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -157,11 +157,11 @@ QUnit.test("rendering when just everyone has seen the message", async (assert) =
const messageId = pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
- const memberIds = pyEnv["mail.channel.member"].search([["channel_id", "=", channelId]]);
- pyEnv["mail.channel.member"].write(memberIds, {
+ const memberIds = pyEnv["discuss.channel.member"].search([["channel_id", "=", channelId]]);
+ pyEnv["discuss.channel.member"].write(memberIds, {
fetched_message_id: messageId,
seen_message_id: messageId,
});
@@ -175,7 +175,7 @@ QUnit.test("rendering when just everyone has seen the message", async (assert) =
QUnit.test("'channel_fetch' notification received is correctly handled", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "test" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -186,7 +186,7 @@ QUnit.test("'channel_fetch' notification received is correctly handled", async (
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -194,10 +194,10 @@ QUnit.test("'channel_fetch' notification received is correctly handled", async (
assert.containsOnce($, ".o-mail-Message");
assert.containsNone($, ".o-mail-MessageSeenIndicator i");
- const channel = pyEnv["mail.channel"].searchRead([["id", "=", channelId]])[0];
+ const channel = pyEnv["discuss.channel"].searchRead([["id", "=", channelId]])[0];
// Simulate received channel fetched notification
await afterNextRender(() => {
- pyEnv["bus.bus"]._sendone(channel, "mail.channel.member/fetched", {
+ pyEnv["bus.bus"]._sendone(channel, "discuss.channel.member/fetched", {
channel_id: channelId,
last_message_id: 100,
partner_id: partnerId,
@@ -209,7 +209,7 @@ QUnit.test("'channel_fetch' notification received is correctly handled", async (
QUnit.test("'channel_seen' notification received is correctly handled", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "test" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -220,7 +220,7 @@ QUnit.test("'channel_seen' notification received is correctly handled", async (a
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -228,10 +228,10 @@ QUnit.test("'channel_seen' notification received is correctly handled", async (a
assert.containsOnce($, ".o-mail-Message");
assert.containsNone($, ".o-mail-MessageSeenIndicator i");
- const channel = pyEnv["mail.channel"].searchRead([["id", "=", channelId]])[0];
+ const channel = pyEnv["discuss.channel"].searchRead([["id", "=", channelId]])[0];
// Simulate received channel seen notification
await afterNextRender(() => {
- pyEnv["bus.bus"]._sendone(channel, "mail.channel.member/seen", {
+ pyEnv["bus.bus"]._sendone(channel, "discuss.channel.member/seen", {
channel_id: channelId,
last_message_id: 100,
partner_id: partnerId,
@@ -245,7 +245,7 @@ QUnit.test(
async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Recipient" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -256,7 +256,7 @@ QUnit.test(
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -264,10 +264,10 @@ QUnit.test(
assert.containsOnce($, ".o-mail-Message");
assert.containsNone($, ".o-mail-MessageSeenIndicator i");
- const channel = pyEnv["mail.channel"].searchRead([["id", "=", channelId]])[0];
+ const channel = pyEnv["discuss.channel"].searchRead([["id", "=", channelId]])[0];
// Simulate received channel fetched notification
await afterNextRender(() => {
- pyEnv["bus.bus"]._sendone(channel, "mail.channel.member/fetched", {
+ pyEnv["bus.bus"]._sendone(channel, "discuss.channel.member/fetched", {
channel_id: channelId,
last_message_id: 100,
partner_id: partnerId,
@@ -277,7 +277,7 @@ QUnit.test(
// Simulate received channel seen notification
await afterNextRender(() => {
- pyEnv["bus.bus"]._sendone(channel, "mail.channel.member/seen", {
+ pyEnv["bus.bus"]._sendone(channel, "discuss.channel.member/seen", {
channel_id: channelId,
last_message_id: 100,
partner_id: partnerId,
@@ -292,7 +292,7 @@ QUnit.test(
async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo User" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
channel_type: "chat",
channel_member_ids: [
@@ -303,11 +303,11 @@ QUnit.test(
const messageId = pyEnv["mail.message"].create({
author_id: partnerId,
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
- const memberIds = pyEnv["mail.channel.member"].search([["channel_id", "=", channelId]]);
- pyEnv["mail.channel.member"].write(memberIds, { seen_message_id: messageId });
+ const memberIds = pyEnv["discuss.channel.member"].search([["channel_id", "=", channelId]]);
+ pyEnv["discuss.channel.member"].write(memberIds, { seen_message_id: messageId });
const { openDiscuss } = await start();
await openDiscuss(channelId);
assert.containsOnce($, ".o-mail-Message");
@@ -320,7 +320,7 @@ QUnit.test(
async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo User" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
channel_type: "chat",
channel_member_ids: [
@@ -332,18 +332,18 @@ QUnit.test(
{
author_id: pyEnv.currentPartnerId,
body: "
Message before last seen
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
{
author_id: pyEnv.currentPartnerId,
body: "
Last seen by everyone
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
]);
- const memberIds = pyEnv["mail.channel.member"].search([["channel_id", "=", channelId]]);
- pyEnv["mail.channel.member"].write(memberIds, { seen_message_id: messageId_2 });
+ const memberIds = pyEnv["discuss.channel.member"].search([["channel_id", "=", channelId]]);
+ pyEnv["discuss.channel.member"].write(memberIds, { seen_message_id: messageId_2 });
const { openDiscuss } = await start();
await openDiscuss(channelId);
assert.containsOnce($, ".o-mail-Message:contains(Message before last seen)");
@@ -363,7 +363,7 @@ QUnit.test(
async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo User" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
channel_type: "chat",
channel_member_ids: [
@@ -375,10 +375,10 @@ QUnit.test(
author_id: pyEnv.currentPartnerId,
body: "
Test
",
res_id: channelId,
- model: "mail.channel",
+ model: "discuss.channel",
});
- const memberIds = pyEnv["mail.channel.member"].search([["channel_id", "=", channelId]]);
- pyEnv["mail.channel.member"].write(memberIds, {
+ const memberIds = pyEnv["discuss.channel.member"].search([["channel_id", "=", channelId]]);
+ pyEnv["discuss.channel.member"].write(memberIds, {
fetched_message_id: messageId,
seen_message_id: messageId - 1,
});
diff --git a/addons/mail/static/tests/message/message_tests.js b/addons/mail/static/tests/message/message_tests.js
index 4b63f037ff1..524cf68308e 100644
--- a/addons/mail/static/tests/message/message_tests.js
+++ b/addons/mail/static/tests/message/message_tests.js
@@ -24,14 +24,14 @@ QUnit.module("message");
QUnit.test("Start edition on click edit", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "Hello world",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -45,14 +45,14 @@ QUnit.test("Start edition on click edit", async (assert) => {
QUnit.test("Cursor is at end of composer input on edit", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "",
});
pyEnv["mail.message"].create({
body: "sattva",
res_id: channelId,
- model: "mail.channel",
+ model: "discuss.channel",
message_type: "comment",
});
const { openDiscuss } = await start();
@@ -67,14 +67,14 @@ QUnit.test("Cursor is at end of composer input on edit", async (assert) => {
QUnit.test("Stop edition on click cancel", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "Hello world",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -88,14 +88,14 @@ QUnit.test("Stop edition on click cancel", async (assert) => {
QUnit.test("Stop edition on press escape", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "Hello world",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -109,14 +109,14 @@ QUnit.test("Stop edition on press escape", async (assert) => {
QUnit.test("Stop edition on click save", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "Hello world",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -130,14 +130,14 @@ QUnit.test("Stop edition on click save", async (assert) => {
QUnit.test("Stop edition on press enter", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "Hello world",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -151,14 +151,14 @@ QUnit.test("Stop edition on press enter", async (assert) => {
QUnit.test("Stop edition on click away", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "Hello world",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -172,14 +172,14 @@ QUnit.test("Stop edition on click away", async (assert) => {
QUnit.test("Do not stop edition on click away when clicking on emoji", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "Hello world",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -194,14 +194,14 @@ QUnit.test("Do not stop edition on click away when clicking on emoji", async (as
QUnit.test("Edit and click save", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "Hello world",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -216,14 +216,14 @@ QUnit.test("Edit and click save", async (assert) => {
QUnit.test("Do not call server on save if no changes", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "Hello world",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -243,14 +243,14 @@ QUnit.test("Do not call server on save if no changes", async (assert) => {
QUnit.test("Scroll bar to the top when edit starts", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "Hello world!".repeat(1000),
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -265,14 +265,14 @@ QUnit.test("Scroll bar to the top when edit starts", async (assert) => {
QUnit.test("mentions are kept when editing message", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "Hello @Mitchell Admin",
- model: "mail.channel",
+ model: "discuss.channel",
partner_ids: [pyEnv.currentPartnerId],
res_id: channelId,
message_type: "comment",
@@ -289,13 +289,13 @@ QUnit.test("mentions are kept when editing message", async (assert) => {
QUnit.test("Other messages are grayed out when replying to another one", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
pyEnv["mail.message"].create([
- { body: "Hello world", res_id: channelId, model: "mail.channel" },
- { body: "Goodbye world", res_id: channelId, model: "mail.channel" },
+ { body: "Hello world", res_id: channelId, model: "discuss.channel" },
+ { body: "Goodbye world", res_id: channelId, model: "discuss.channel" },
]);
const { openDiscuss } = await start();
await openDiscuss(channelId);
@@ -307,14 +307,14 @@ QUnit.test("Other messages are grayed out when replying to another one", async (
QUnit.test("Parent message body is displayed on replies", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
pyEnv["mail.message"].create({
body: "Hello world",
res_id: channelId,
- model: "mail.channel",
+ model: "discuss.channel",
});
const { openDiscuss } = await start();
await openDiscuss(channelId);
@@ -329,7 +329,7 @@ QUnit.test(
"Updating the parent message of a reply also updates the visual of the reply",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -337,7 +337,7 @@ QUnit.test(
body: "Hello world",
res_id: channelId,
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
});
const { openDiscuss } = await start();
await openDiscuss(channelId);
@@ -355,7 +355,7 @@ QUnit.test(
QUnit.test("Deleting parent message of a reply should adapt reply visual", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -363,7 +363,7 @@ QUnit.test("Deleting parent message of a reply should adapt reply visual", async
body: "Hello world",
res_id: channelId,
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
});
const { openDiscuss } = await start();
await openDiscuss(channelId);
@@ -378,7 +378,7 @@ QUnit.test("Deleting parent message of a reply should adapt reply visual", async
QUnit.test("Can open emoji picker after edit mode", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -386,7 +386,7 @@ QUnit.test("Can open emoji picker after edit mode", async (assert) => {
body: "Hello world",
res_id: channelId,
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
});
const { openDiscuss } = await start();
await openDiscuss(channelId);
@@ -399,7 +399,7 @@ QUnit.test("Can open emoji picker after edit mode", async (assert) => {
QUnit.test("Can add a reaction", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -407,7 +407,7 @@ QUnit.test("Can add a reaction", async (assert) => {
body: "Hello world",
res_id: channelId,
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
});
const { openDiscuss } = await start();
await openDiscuss(channelId);
@@ -418,7 +418,7 @@ QUnit.test("Can add a reaction", async (assert) => {
QUnit.test("Can remove a reaction", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -426,7 +426,7 @@ QUnit.test("Can remove a reaction", async (assert) => {
body: "Hello world",
res_id: channelId,
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
});
const { openDiscuss } = await start();
await openDiscuss(channelId);
@@ -439,7 +439,7 @@ QUnit.test("Can remove a reaction", async (assert) => {
QUnit.test("Two users reacting with the same emoji", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -447,7 +447,7 @@ QUnit.test("Two users reacting with the same emoji", async (assert) => {
body: "Hello world",
res_id: channelId,
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
});
pyEnv["mail.message.reaction"].create([
{
@@ -472,7 +472,7 @@ QUnit.test("Two users reacting with the same emoji", async (assert) => {
QUnit.test("Reaction summary", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -480,7 +480,7 @@ QUnit.test("Reaction summary", async (assert) => {
body: "Hello world",
res_id: channelId,
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
});
const { openDiscuss } = await start();
await openDiscuss(channelId);
@@ -502,7 +502,7 @@ QUnit.test("Reaction summary", async (assert) => {
QUnit.test("Add the same reaction twice from the emoji picker", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -510,7 +510,7 @@ QUnit.test("Add the same reaction twice from the emoji picker", async (assert) =
body: "Hello world",
res_id: channelId,
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
});
const { openDiscuss } = await start();
await openDiscuss(channelId);
@@ -523,13 +523,13 @@ QUnit.test("Add the same reaction twice from the emoji picker", async (assert) =
QUnit.test("basic rendering of message", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
pyEnv["mail.message"].create({
author_id: partnerId,
body: "
body
",
date: "2019-04-20 10:00:00",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -541,7 +541,7 @@ QUnit.test("basic rendering of message", async (assert) => {
assert.hasAttrValue(
$message.find(".o-mail-Message-sidebar .o-mail-Message-avatarContainer img"),
"data-src",
- url(`/mail/channel/${channelId}/partner/${partnerId}/avatar_128`)
+ url(`/discuss/channel/${channelId}/partner/${partnerId}/avatar_128`)
);
assert.containsOnce($message, ".o-mail-Message-header");
assert.containsOnce($message, ".o-mail-Message-header .o-mail-Message-author:contains(Demo)");
@@ -557,7 +557,7 @@ QUnit.test("basic rendering of message", async (assert) => {
QUnit.test("should not be able to reply to temporary/transient messages", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
// these user interactions is to forge a transient message response from channel command "/who"
@@ -571,7 +571,7 @@ QUnit.test("message comment of same author within 1min. should be squashed", asy
// from messages of same author and same thread. Note that this should
// be working in non-mailboxes
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
pyEnv["mail.message"].create([
{
@@ -579,7 +579,7 @@ QUnit.test("message comment of same author within 1min. should be squashed", asy
body: "
body1
",
date: "2019-04-20 10:00:00",
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
{
@@ -587,7 +587,7 @@ QUnit.test("message comment of same author within 1min. should be squashed", asy
body: "
body2
",
date: "2019-04-20 10:00:30",
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
]);
@@ -610,7 +610,7 @@ QUnit.test("redirect to author (open chat)", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
pyEnv["res.users"].create({ partner_id: partnerId });
- const [channelId_1] = pyEnv["mail.channel"].create([
+ const [channelId_1] = pyEnv["discuss.channel"].create([
{ name: "General" },
{
channel_member_ids: [
@@ -623,7 +623,7 @@ QUnit.test("redirect to author (open chat)", async (assert) => {
pyEnv["mail.message"].create({
author_id: partnerId,
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_1,
});
const { openDiscuss } = await start();
@@ -637,10 +637,10 @@ QUnit.test("redirect to author (open chat)", async (assert) => {
QUnit.test("toggle_star message", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const messageId = pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start({
@@ -674,18 +674,18 @@ QUnit.test(
"Name of message author is only displayed in chat window for partners others than the current user",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ channel_type: "channel" });
+ const channelId = pyEnv["discuss.channel"].create({ channel_type: "channel" });
const partnerId = pyEnv["res.partner"].create({ name: "Not the current user" });
pyEnv["mail.message"].create([
{
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
{
author_id: partnerId,
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
]);
@@ -701,18 +701,18 @@ QUnit.test(
"Name of message author is not displayed in chat window for channel of type chat",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ channel_type: "chat" });
+ const channelId = pyEnv["discuss.channel"].create({ channel_type: "chat" });
const partnerId = pyEnv["res.partner"].create({ name: "A" });
pyEnv["mail.message"].create([
{
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
{
author_id: partnerId,
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
]);
@@ -725,11 +725,11 @@ QUnit.test(
QUnit.test("click on message edit button should open edit composer", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
pyEnv["mail.message"].create({
body: "not empty",
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -821,21 +821,21 @@ QUnit.test(
'Quick edit (edit from Composer with ArrowUp) ignores empty ("deleted") messages.',
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "", // empty body
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -851,14 +851,14 @@ QUnit.test(
"Editing a message to clear its composer opens message delete dialog.",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -879,14 +879,14 @@ QUnit.test(
"Clear message body should not open message delete dialog if it has attachments",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
attachment_ids: [
@@ -912,14 +912,14 @@ QUnit.test(
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ display_name: "Test Partner" });
pyEnv["res.users"].create({ partner_id: partnerId });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "General",
});
pyEnv["mail.message"].create({
author_id: partnerId,
body: "hello @Admin",
- model: "mail.channel",
+ model: "discuss.channel",
partner_ids: [pyEnv.currentPartnerId],
res_id: channelId,
});
@@ -938,14 +938,14 @@ QUnit.test(
email: "testPartner@odoo.com",
});
pyEnv["res.users"].create({ partner_id: partnerId });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "General",
});
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "hello @testPartner",
- model: "mail.channel",
+ model: "discuss.channel",
partner_ids: [partnerId],
res_id: channelId,
});
@@ -957,7 +957,7 @@ QUnit.test(
QUnit.test("allow attachment delete on authored message", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "test" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "test" });
pyEnv["mail.message"].create({
attachment_ids: [
[
@@ -967,13 +967,13 @@ QUnit.test("allow attachment delete on authored message", async (assert) => {
mimetype: "image/jpeg",
name: "BLAH",
res_id: channelId,
- res_model: "mail.channel",
+ res_model: "discuss.channel",
},
],
],
author_id: pyEnv.currentPartnerId,
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -993,7 +993,7 @@ QUnit.test("allow attachment delete on authored message", async (assert) => {
QUnit.test("prevent attachment delete on non-authored message in channels", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({});
- const channelId = pyEnv["mail.channel"].create({ name: "test" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "test" });
pyEnv["mail.message"].create({
attachment_ids: [
[
@@ -1003,13 +1003,13 @@ QUnit.test("prevent attachment delete on non-authored message in channels", asyn
mimetype: "image/jpeg",
name: "BLAH",
res_id: channelId,
- res_model: "mail.channel",
+ res_model: "discuss.channel",
},
],
],
author_id: partnerId,
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -1020,14 +1020,14 @@ QUnit.test("prevent attachment delete on non-authored message in channels", asyn
QUnit.test("Toggle star should update starred counter on all tabs", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_type: "channel",
});
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "Hello world",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -1041,7 +1041,7 @@ QUnit.test("Toggle star should update starred counter on all tabs", async (asser
QUnit.test("allow attachment image download on message", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "test" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "test" });
const attachmentId = pyEnv["ir.attachment"].create({
name: "Blah.jpg",
mimetype: "image/jpeg",
@@ -1049,7 +1049,7 @@ QUnit.test("allow attachment image download on message", async (assert) => {
pyEnv["mail.message"].create({
attachment_ids: [attachmentId],
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -1215,7 +1215,7 @@ QUnit.test(
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "test" });
pyEnv["res.users"].create({ partner_id: partnerId });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -1226,7 +1226,7 @@ QUnit.test(
pyEnv["mail.message"].create({
author_id: partnerId,
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -1243,7 +1243,7 @@ QUnit.test(
QUnit.test("Channel should be opened after clicking on its mention", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({});
- pyEnv["mail.channel"].create({ name: "my-channel" });
+ pyEnv["discuss.channel"].create({ name: "my-channel" });
const { openFormView } = await start();
await openFormView("res.partner", partnerId);
await click("button:contains(Send message)");
@@ -1263,11 +1263,11 @@ QUnit.test(
mimetype: "text/plain",
name: "Blah.txt",
});
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
pyEnv["mail.message"].create({
attachment_ids: [attachmentId],
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -1288,12 +1288,12 @@ QUnit.test(
mimetype: "text/plain",
name: "Blah.txt",
});
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
pyEnv["mail.message"].create({
attachment_ids: [attachmentId],
body: "Some content",
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -1310,10 +1310,10 @@ QUnit.test(
"message with subtype should be displayed (and not considered as empty)",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const subtypeId = pyEnv["mail.message.subtype"].create({ description: "Task created" });
pyEnv["mail.message"].create({
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
subtype_id: subtypeId,
});
@@ -1326,45 +1326,45 @@ QUnit.test(
QUnit.test("message considered empty", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
pyEnv["mail.message"].create([
{
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
{
body: "",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
{
body: "
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
{
body: "
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
{
body: "
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
{
body: "
\n
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
{
body: "
\r\n\r\n
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
{
body: "
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
]);
@@ -1375,10 +1375,10 @@ QUnit.test("message considered empty", async (assert) => {
QUnit.test("message with html not to be considered empty", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
pyEnv["mail.message"].create({
body: "
![]()
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -1388,10 +1388,10 @@ QUnit.test("message with html not to be considered empty", async (assert) => {
QUnit.test("message with body 'test' should not be considered empty", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
pyEnv["mail.message"].create({
body: "test",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -1420,20 +1420,20 @@ QUnit.test("Can reply to chatter messages from history", async (assert) => {
QUnit.test("Mark as unread", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "chat",
name: "General",
});
const messageId = pyEnv["mail.message"].create({
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
body: "Hello World!",
});
- const [memberId] = pyEnv["mail.channel.member"].search([
+ const [memberId] = pyEnv["discuss.channel.member"].search([
["channel_id", "=", channelId],
["partner_id", "=", pyEnv.currentPartnerId],
]);
- pyEnv["mail.channel.member"].write([memberId], {
+ pyEnv["discuss.channel.member"].write([memberId], {
seen_message_id: messageId,
});
const { openDiscuss } = await start();
diff --git a/addons/mail/static/tests/messaging/messaging_tests.js b/addons/mail/static/tests/messaging/messaging_tests.js
index aec6a6d3e1c..ee203dc03d6 100644
--- a/addons/mail/static/tests/messaging/messaging_tests.js
+++ b/addons/mail/static/tests/messaging/messaging_tests.js
@@ -10,14 +10,14 @@ QUnit.test(
const { env, pyEnv } = await start();
const partnerId = pyEnv["res.partner"].create({ name: "Dumbledore" });
const userId = pyEnv["res.users"].create({ partner_id: partnerId });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: partnerId }],
],
channel_type: "chat",
});
- const [channel] = pyEnv["mail.channel"].searchRead([["id", "=", channelId]]);
+ const [channel] = pyEnv["discuss.channel"].searchRead([["id", "=", channelId]]);
await afterNextRender(() =>
env.services.rpc("/mail/chat_post", {
context: { mockedUserId: userId },
@@ -36,14 +36,14 @@ QUnit.test(
await openDiscuss();
const partnerId = pyEnv["res.partner"].create({ name: "Dumbledore" });
const userId = pyEnv["res.users"].create({ partner_id: partnerId });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: partnerId }],
],
channel_type: "chat",
});
- const [channel] = pyEnv["mail.channel"].searchRead([["id", "=", channelId]]);
+ const [channel] = pyEnv["discuss.channel"].searchRead([["id", "=", channelId]]);
env.services.rpc("/mail/chat_post", {
context: { mockedUserId: userId },
message_content: "new message",
diff --git a/addons/mail/static/tests/messaging_menu/messaging_menu_tests.js b/addons/mail/static/tests/messaging_menu/messaging_menu_tests.js
index 64a43d08303..7c55deb0cb5 100644
--- a/addons/mail/static/tests/messaging_menu/messaging_menu_tests.js
+++ b/addons/mail/static/tests/messaging_menu/messaging_menu_tests.js
@@ -40,16 +40,16 @@ QUnit.test("messaging menu should have topbar buttons", async (assert) => {
QUnit.test("counter is taking into account failure notification", async (assert) => {
patchBrowserNotification("denied");
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({});
+ const channelId = pyEnv["discuss.channel"].create({});
const messageId = pyEnv["mail.message"].create({
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
- const [memberId] = pyEnv["mail.channel.member"].search([
+ const [memberId] = pyEnv["discuss.channel.member"].search([
["channel_id", "=", channelId],
["partner_id", "=", pyEnv.currentPartnerId],
]);
- pyEnv["mail.channel.member"].write([memberId], {
+ pyEnv["discuss.channel.member"].write([memberId], {
seen_message_id: messageId,
});
pyEnv["mail.notification"].create({
@@ -314,21 +314,21 @@ QUnit.test("non-failure notifications are ignored", async (assert) => {
QUnit.test("mark unread channel as read", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { message_unread_counter: 1, partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: partnerId }],
],
});
const [messagId_1] = pyEnv["mail.message"].create([
- { author_id: partnerId, model: "mail.channel", res_id: channelId },
- { author_id: partnerId, model: "mail.channel", res_id: channelId },
+ { author_id: partnerId, model: "discuss.channel", res_id: channelId },
+ { author_id: partnerId, model: "discuss.channel", res_id: channelId },
]);
- const [currentMemberId] = pyEnv["mail.channel.member"].search([
+ const [currentMemberId] = pyEnv["discuss.channel.member"].search([
["channel_id", "=", channelId],
["partner_id", "=", pyEnv.currentPartnerId],
]);
- pyEnv["mail.channel.member"].write([currentMemberId], { seen_message_id: messagId_1 });
+ pyEnv["discuss.channel.member"].write([currentMemberId], { seen_message_id: messagId_1 });
await start({
async mockRPC(route, args) {
if (route.includes("set_last_seen_message")) {
@@ -352,7 +352,7 @@ QUnit.test("mark failure as read", async (assert) => {
message_type: "email",
res_model_name: "Channel",
});
- pyEnv["mail.channel"].create({
+ pyEnv["discuss.channel"].create({
message_ids: [messageId],
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId, seen_message_id: messageId }],
@@ -380,22 +380,22 @@ QUnit.test("mark failure as read", async (assert) => {
);
});
-QUnit.test("different mail.channel are not grouped", async (assert) => {
+QUnit.test("different discuss.channel are not grouped", async (assert) => {
const pyEnv = await startServer();
- const [channelId_1, channelId_2] = pyEnv["mail.channel"].create([
+ const [channelId_1, channelId_2] = pyEnv["discuss.channel"].create([
{ name: "Channel_1" },
{ name: "Channel_2" },
]);
const [messageId_1, messageId_2] = pyEnv["mail.message"].create([
{
message_type: "email",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_1,
res_model_name: "Channel",
},
{
message_type: "email",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_2,
res_model_name: "Channel",
},
@@ -441,7 +441,7 @@ QUnit.test("mobile: active icon is highlighted", async (assert) => {
QUnit.test("open chat window from preview", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "test" });
+ pyEnv["discuss.channel"].create({ name: "test" });
await start();
await click(".o_menu_systray i[aria-label='Messages']");
await click(".o-mail-NotificationItem");
@@ -502,7 +502,7 @@ QUnit.test('"Start a conversation" item selection opens chat', async (assert) =>
QUnit.test('"New channel" item selection opens channel (existing)', async (assert) => {
patchUiSize({ height: 360, width: 640 });
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "Gryffindors" });
+ pyEnv["discuss.channel"].create({ name: "Gryffindors" });
const { openDiscuss } = await start();
await openDiscuss();
await click("button:contains(Channel)");
@@ -533,7 +533,7 @@ QUnit.test("'New Message' button should open a chat window in mobile", async (as
QUnit.test("Counter is updated when receiving new message", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const partnerId = pyEnv["res.partner"].create({ name: "Albert" });
const userId = pyEnv["res.users"].create({ partner_id: partnerId });
const { env, openDiscuss } = await start();
@@ -541,7 +541,7 @@ QUnit.test("Counter is updated when receiving new message", async (assert) => {
await afterNextRender(() =>
env.services.rpc("/mail/message/post", {
thread_id: channelId,
- thread_model: "mail.channel",
+ thread_model: "discuss.channel",
post_data: {
body: "Hello world",
message_type: "comment",
@@ -626,13 +626,13 @@ QUnit.test("new message [REQUIRE FOCUS]", async (assert) => {
QUnit.test("channel preview: basic rendering", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "General",
});
pyEnv["mail.message"].create({
author_id: partnerId,
body: "
test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
await start();
@@ -645,17 +645,17 @@ QUnit.test("channel preview: basic rendering", async (assert) => {
QUnit.test("filtered previews", async (assert) => {
const pyEnv = await startServer();
- const [channelId_1, channelId_2] = pyEnv["mail.channel"].create([
+ const [channelId_1, channelId_2] = pyEnv["discuss.channel"].create([
{ channel_type: "chat" },
- { name: "mailChannel1" },
+ { name: "channel1" },
]);
pyEnv["mail.message"].create([
{
- model: "mail.channel", // to link message to channel
+ model: "discuss.channel", // to link message to channel
res_id: channelId_1, // id of related channel
},
{
- model: "mail.channel", // to link message to channel
+ model: "discuss.channel", // to link message to channel
res_id: channelId_2, // id of related channel
},
]);
@@ -663,24 +663,24 @@ QUnit.test("filtered previews", async (assert) => {
await click(".o_menu_systray .dropdown-toggle:has(i[aria-label='Messages'])");
assert.containsN($, ".o-mail-NotificationItem", 2);
assert.containsOnce($, '.o-mail-NotificationItem:contains("Mitchell Admin")');
- assert.containsOnce($, '.o-mail-NotificationItem:contains("mailChannel1")');
+ assert.containsOnce($, '.o-mail-NotificationItem:contains("channel1")');
await click('.o-mail-MessagingMenu button:contains("Chats")');
assert.containsOnce($, '.o-mail-NotificationItem:contains("Mitchell Admin")');
await click('.o-mail-MessagingMenu button:contains("Channels")');
- assert.containsOnce($, '.o-mail-NotificationItem:contains("mailChannel1")');
+ assert.containsOnce($, '.o-mail-NotificationItem:contains("channel1")');
await click('.o-mail-MessagingMenu button:contains("All")');
assert.containsN($, ".o-mail-NotificationItem", 2);
assert.containsOnce($, '.o-mail-NotificationItem:contains("Mitchell Admin")');
await click('.o-mail-MessagingMenu button:contains("Channels")');
- assert.containsOnce($, '.o-mail-NotificationItem:contains("mailChannel1")');
+ assert.containsOnce($, '.o-mail-NotificationItem:contains("channel1")');
});
QUnit.test("no code injection in message body preview", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({});
+ const channelId = pyEnv["discuss.channel"].create({});
pyEnv["mail.message"].create({
body: "
&shoulnotberaised
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
await start();
@@ -695,10 +695,10 @@ QUnit.test("no code injection in message body preview", async (assert) => {
QUnit.test("no code injection in message body preview from sanitized message", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({});
+ const channelId = pyEnv["discuss.channel"].create({});
pyEnv["mail.message"].create({
body: "
<em>&shoulnotberaised</em><script>throw new Error('CodeInjectionError');</script>
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
await start();
@@ -714,10 +714,10 @@ QUnit.test("no code injection in message body preview from sanitized message", a
QUnit.test("
tags in message body preview are transformed in spaces", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({});
+ const channelId = pyEnv["discuss.channel"].create({});
pyEnv["mail.message"].create({
body: "
a
b
c
d
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
await start();
@@ -731,7 +731,7 @@ QUnit.test(
"Group chat should be displayed inside the chat section of the messaging menu",
async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ channel_type: "group" });
+ pyEnv["discuss.channel"].create({ channel_type: "group" });
await start();
await click(".o_menu_systray .dropdown-toggle:has(i[aria-label='Messages'])");
await click('.o-mail-MessagingMenu button:contains("Chats")');
@@ -837,7 +837,7 @@ QUnit.test(
async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Partner1" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "Test",
channel_member_ids: [
[0, 0, { message_unread_counter: 2, partner_id: pyEnv.currentPartnerId }],
@@ -846,7 +846,7 @@ QUnit.test(
const messageId = pyEnv["mail.message"].create({
author_id: partnerId,
body: "Message with needaction",
- model: "mail.channel",
+ model: "discuss.channel",
needaction: true,
needaction_partner_ids: [pyEnv.currentPartnerId],
res_id: channelId,
@@ -860,7 +860,7 @@ QUnit.test(
pyEnv["mail.message"].create({
author_id: partnerId,
body: "Message without needaction",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
@@ -878,17 +878,17 @@ QUnit.test(
QUnit.test("preview for channel should show latest non-deleted message", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Partner1" });
- const channelId = pyEnv["mail.channel"].create({ name: "Test" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "Test" });
pyEnv["mail.message"].create({
author_id: partnerId,
body: "message-1",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const messageId_2 = pyEnv["mail.message"].create({
author_id: partnerId,
body: "message-2",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { env } = await start();
@@ -914,24 +914,24 @@ QUnit.test("failure notifications are shown before channel preview", async (asse
message_type: "email",
res_model_name: "Channel",
});
- const channelId = pyEnv["mail.channel"].create({ name: "Test" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "Test" });
const messageId = pyEnv["mail.message"].create({
author_id: partnerId,
body: "message",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
- pyEnv["mail.channel"].write([channelId], { message_ids: [messageId, failedMessageId] });
+ pyEnv["discuss.channel"].write([channelId], { message_ids: [messageId, failedMessageId] });
pyEnv["mail.notification"].create({
mail_message_id: failedMessageId,
notification_status: "exception",
notification_type: "email",
});
- const [memberId] = pyEnv["mail.channel.member"].search([
+ const [memberId] = pyEnv["discuss.channel.member"].search([
["channel_id", "=", channelId],
["partner_id", "=", pyEnv.currentPartnerId],
]);
- pyEnv["mail.channel.member"].write([memberId], { seen_message_id: messageId });
+ pyEnv["discuss.channel.member"].write([memberId], { seen_message_id: messageId });
await start();
await click(".o_menu_systray i[aria-label='Messages']");
assert.containsOnce(
diff --git a/addons/mail/static/tests/messaging_menu/notification_tests.js b/addons/mail/static/tests/messaging_menu/notification_tests.js
index 81924312467..1efffd68955 100644
--- a/addons/mail/static/tests/messaging_menu/notification_tests.js
+++ b/addons/mail/static/tests/messaging_menu/notification_tests.js
@@ -8,10 +8,10 @@ QUnit.module("notification");
QUnit.test("basic layout", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({});
+ const channelId = pyEnv["discuss.channel"].create({});
const messageId = pyEnv["mail.message"].create({
message_type: "email",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
res_model_name: "Channel",
});
@@ -43,10 +43,10 @@ QUnit.test("basic layout", async (assert) => {
QUnit.test("mark as read", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({});
+ const channelId = pyEnv["discuss.channel"].create({});
const messageId = pyEnv["mail.message"].create({
message_type: "email",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
res_model_name: "Channel",
});
@@ -129,22 +129,22 @@ QUnit.test("open non-channel failure", async (assert) => {
assert.verifySteps(["do_action"]);
});
-QUnit.test("different mail.channel are not grouped", async (assert) => {
+QUnit.test("different discuss.channel are not grouped", async (assert) => {
const pyEnv = await startServer();
- const [channelId_1, channelId_2] = pyEnv["mail.channel"].create([
+ const [channelId_1, channelId_2] = pyEnv["discuss.channel"].create([
{ name: "Channel_1" },
{ name: "Channel_2" },
]);
const [messageId_1, messageId_2] = pyEnv["mail.message"].create([
{
message_type: "email",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_1,
res_model_name: "Channel",
},
{
message_type: "email",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_2,
res_model_name: "Channel",
},
@@ -246,19 +246,19 @@ QUnit.test(
"marked as read thread notifications are ordered by last message date",
async (assert) => {
const pyEnv = await startServer();
- const [channelId_1, channelId_2] = pyEnv["mail.channel"].create([
+ const [channelId_1, channelId_2] = pyEnv["discuss.channel"].create([
{ name: "Channel 2019" },
{ name: "Channel 2020" },
]);
pyEnv["mail.message"].create([
{
date: "2019-01-01 00:00:00",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_1,
},
{
date: "2020-01-01 00:00:00",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_2,
},
]);
@@ -272,19 +272,19 @@ QUnit.test(
QUnit.test("thread notifications are re-ordered on receiving a new message", async (assert) => {
const pyEnv = await startServer();
- const [channelId_1, channelId_2] = pyEnv["mail.channel"].create([
+ const [channelId_1, channelId_2] = pyEnv["discuss.channel"].create([
{ name: "Channel 2019" },
{ name: "Channel 2020" },
]);
pyEnv["mail.message"].create([
{
date: "2019-01-01 00:00:00",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_1,
},
{
date: "2020-01-01 00:00:00",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId_2,
},
]);
@@ -292,9 +292,9 @@ QUnit.test("thread notifications are re-ordered on receiving a new message", asy
await click(".o_menu_systray i[aria-label='Messages']");
assert.containsN($, ".o-mail-NotificationItem", 2);
- const channel_1 = pyEnv["mail.channel"].searchRead([["id", "=", channelId_1]])[0];
+ const channel_1 = pyEnv["discuss.channel"].searchRead([["id", "=", channelId_1]])[0];
await afterNextRender(() => {
- pyEnv["bus.bus"]._sendone(channel_1, "mail.channel/new_message", {
+ pyEnv["bus.bus"]._sendone(channel_1, "discuss.channel/new_message", {
id: channelId_1,
message: {
author: { id: 7, name: "Demo User" },
@@ -302,7 +302,7 @@ QUnit.test("thread notifications are re-ordered on receiving a new message", asy
date: "2020-03-23 10:00:00",
id: 44,
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
record_name: "Channel 2019",
res_id: channelId_1,
},
diff --git a/addons/mail/static/tests/mobile/mobile_tests.js b/addons/mail/static/tests/mobile/mobile_tests.js
index f8a2f1964c7..5d9d4046f4a 100644
--- a/addons/mail/static/tests/mobile/mobile_tests.js
+++ b/addons/mail/static/tests/mobile/mobile_tests.js
@@ -7,7 +7,7 @@ QUnit.module("mobile");
QUnit.test("auto-select 'Inbox' when discuss had channel as active thread", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "test" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "test" });
patchUiSize({ height: 360, width: 640 });
const { openDiscuss } = await start();
diff --git a/addons/mail/static/tests/suggestion/suggestion_tests.js b/addons/mail/static/tests/suggestion/suggestion_tests.js
index ddc256a2735..f2f087f0ace 100644
--- a/addons/mail/static/tests/suggestion/suggestion_tests.js
+++ b/addons/mail/static/tests/suggestion/suggestion_tests.js
@@ -31,7 +31,7 @@ QUnit.test('display partner mention suggestions on typing "@"', async (assert) =
name: "TestPartner2",
});
pyEnv["res.users"].create({ partner_id: partnerId_1 });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -60,7 +60,7 @@ QUnit.test(
name: "TestPartner2",
});
pyEnv["res.users"].create({ partner_id: partnerId_1 });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -96,7 +96,7 @@ QUnit.test("show other channel member in @ mention", async (assert) => {
email: "testpartner@odoo.com",
name: "TestPartner",
});
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -115,7 +115,7 @@ QUnit.test("select @ mention insert mention text in composer", async (assert) =>
email: "testpartner@odoo.com",
name: "TestPartner",
});
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "general",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -131,7 +131,7 @@ QUnit.test("select @ mention insert mention text in composer", async (assert) =>
QUnit.test('display command suggestions on typing "/"', async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "General",
channel_type: "channel",
});
@@ -144,7 +144,7 @@ QUnit.test('display command suggestions on typing "/"', async (assert) => {
QUnit.test("use a command for a specific channel type", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ channel_type: "chat" });
+ const channelId = pyEnv["discuss.channel"].create({ channel_type: "chat" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
assert.containsNone($, ".o-mail-Composer-suggestionList .o-open");
@@ -162,7 +162,7 @@ QUnit.test(
"command suggestion should only open if command is the first character",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "General",
channel_type: "channel",
});
@@ -179,7 +179,7 @@ QUnit.test(
QUnit.test('display channel mention suggestions on typing "#"', async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "General",
channel_type: "channel",
});
@@ -192,7 +192,7 @@ QUnit.test('display channel mention suggestions on typing "#"', async (assert) =
QUnit.test("mention a channel", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "General",
channel_type: "channel",
});
@@ -212,7 +212,7 @@ QUnit.test("mention a channel", async (assert) => {
QUnit.test("Channel suggestions do not crash after rpc returns", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const deferred = makeDeferred();
const { openDiscuss } = await start({
async mockRPC(args, params, originalFn) {
@@ -226,7 +226,7 @@ QUnit.test("Channel suggestions do not crash after rpc returns", async (assert)
},
});
await openDiscuss(channelId);
- pyEnv["mail.channel"].create({ name: "foo" });
+ pyEnv["discuss.channel"].create({ name: "foo" });
insertText(".o-mail-Composer-input", "#");
await nextTick();
insertText(".o-mail-Composer-input", "f");
diff --git a/addons/mail/static/tests/thread/attachment_list_tests.js b/addons/mail/static/tests/thread/attachment_list_tests.js
index 31f68b9a39d..785557bdb89 100644
--- a/addons/mail/static/tests/thread/attachment_list_tests.js
+++ b/addons/mail/static/tests/thread/attachment_list_tests.js
@@ -7,7 +7,7 @@ QUnit.module("attachment list");
QUnit.test("simplest layout", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -18,7 +18,7 @@ QUnit.test("simplest layout", async (assert) => {
pyEnv["mail.message"].create({
attachment_ids: [attachmentId],
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -36,7 +36,7 @@ QUnit.test("simplest layout", async (assert) => {
QUnit.test("layout with card details and filename and extension", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -47,7 +47,7 @@ QUnit.test("layout with card details and filename and extension", async (assert)
pyEnv["mail.message"].create({
attachment_ids: [attachmentId],
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -61,7 +61,7 @@ QUnit.test(
"clicking on the delete attachment button multiple times should do the rpc only once",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -72,7 +72,7 @@ QUnit.test(
pyEnv["mail.message"].create({
attachment_ids: [attachmentId],
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -96,7 +96,7 @@ QUnit.test(
QUnit.test("view attachment", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -107,7 +107,7 @@ QUnit.test("view attachment", async (assert) => {
pyEnv["mail.message"].create({
attachment_ids: [attachmentId],
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -120,7 +120,7 @@ QUnit.test("view attachment", async (assert) => {
QUnit.test("close attachment viewer", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -131,7 +131,7 @@ QUnit.test("close attachment viewer", async (assert) => {
pyEnv["mail.message"].create({
attachment_ids: [attachmentId],
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -159,7 +159,7 @@ QUnit.test(
* loaded from being viewed for 1st time, but viewer being closed while image is loading.
*/
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -170,7 +170,7 @@ QUnit.test(
pyEnv["mail.message"].create({
attachment_ids: [attachmentId],
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -194,7 +194,7 @@ QUnit.test(
QUnit.test("plain text file is viewable", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -205,7 +205,7 @@ QUnit.test("plain text file is viewable", async (assert) => {
pyEnv["mail.message"].create({
attachment_ids: [attachmentId],
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -216,7 +216,7 @@ QUnit.test("plain text file is viewable", async (assert) => {
QUnit.test("HTML file is viewable", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -227,7 +227,7 @@ QUnit.test("HTML file is viewable", async (assert) => {
pyEnv["mail.message"].create({
attachment_ids: [attachmentId],
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -238,7 +238,7 @@ QUnit.test("HTML file is viewable", async (assert) => {
QUnit.test("ODT file is not viewable", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -249,7 +249,7 @@ QUnit.test("ODT file is not viewable", async (assert) => {
pyEnv["mail.message"].create({
attachment_ids: [attachmentId],
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -260,7 +260,7 @@ QUnit.test("ODT file is not viewable", async (assert) => {
QUnit.test("DOCX file is not viewable", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -271,7 +271,7 @@ QUnit.test("DOCX file is not viewable", async (assert) => {
pyEnv["mail.message"].create({
attachment_ids: [attachmentId],
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -284,7 +284,7 @@ QUnit.test(
"should not view attachment from click on non-viewable attachment in list containing a viewable attachment",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -301,7 +301,7 @@ QUnit.test(
pyEnv["mail.message"].create({
attachment_ids: [attachmentId_1, attachmentId_2],
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -321,9 +321,9 @@ QUnit.test(
}
);
-QUnit.test("img file has proper src in mail.channel", async (assert) => {
+QUnit.test("img file has proper src in discuss.channel", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "channel1",
});
@@ -331,12 +331,12 @@ QUnit.test("img file has proper src in mail.channel", async (assert) => {
name: "test.png",
mimetype: "image/png",
res_id: channelId,
- res_model: "mail.channel",
+ res_model: "discuss.channel",
});
pyEnv["mail.message"].create({
attachment_ids: [attachmentId],
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
message_type: "comment",
});
@@ -345,6 +345,6 @@ QUnit.test("img file has proper src in mail.channel", async (assert) => {
assert.ok(
$(".o-mail-AttachmentImage[title='test.png'] img")
.data("src")
- .includes(`/mail/channel/${channelId}/image`)
+ .includes(`/discuss/channel/${channelId}/image`)
);
});
diff --git a/addons/mail/static/tests/thread/file_upload_tests.js b/addons/mail/static/tests/thread/file_upload_tests.js
index 804fe95defb..9d6252bfd48 100644
--- a/addons/mail/static/tests/thread/file_upload_tests.js
+++ b/addons/mail/static/tests/thread/file_upload_tests.js
@@ -11,10 +11,10 @@ QUnit.module("file upload");
QUnit.test("no conflicts between file uploads", async (assert) => {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({});
- const channelId = pyEnv["mail.channel"].create({});
+ const channelId = pyEnv["discuss.channel"].create({});
pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openView } = await start();
@@ -33,7 +33,7 @@ QUnit.test("no conflicts between file uploads", async (assert) => {
await afterNextRender(() =>
editInput(document.body, ".o-mail-Chatter .o-mail-Composer input[type=file]", file1)
);
- // Uploading file in the second thread: mail.channel in chatWindow.
+ // Uploading file in the second thread: discuss.channel in chatWindow.
await click("i[aria-label='Messages']");
await click(".o-mail-NotificationItem");
const file2 = await createFile({
@@ -50,7 +50,7 @@ QUnit.test("no conflicts between file uploads", async (assert) => {
QUnit.test("Attachment shows spinner during upload", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "channel_1" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "channel_1" });
const { openDiscuss } = await start({
async mockRPC(route) {
if (route === "/mail/attachment/upload") {
diff --git a/addons/mail/static/tests/thread/thread_tests.js b/addons/mail/static/tests/thread/thread_tests.js
index 49fbd978ca4..913cb165fb1 100644
--- a/addons/mail/static/tests/thread/thread_tests.js
+++ b/addons/mail/static/tests/thread/thread_tests.js
@@ -25,7 +25,7 @@ QUnit.module("thread");
QUnit.test("dragover files on thread with composer", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
group_public_id: false,
name: "General",
@@ -38,7 +38,7 @@ QUnit.test("dragover files on thread with composer", async (assert) => {
QUnit.test("load more messages from channel (auto-load on scroll)", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
group_public_id: false,
name: "General",
@@ -46,7 +46,7 @@ QUnit.test("load more messages from channel (auto-load on scroll)", async (asser
for (let i = 0; i <= 60; i++) {
pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
}
@@ -62,14 +62,14 @@ QUnit.test(
"show message subject when subject is not the same as the thread name",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
group_public_id: false,
name: "General",
});
pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
subject: "Salutations, voyageur",
});
@@ -84,14 +84,14 @@ QUnit.test(
"do not show message subject when subject is the same as the thread name",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
group_public_id: false,
name: "Salutations, voyageur",
});
pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
subject: "Salutations, voyageur",
});
@@ -103,11 +103,11 @@ QUnit.test(
QUnit.test("auto-scroll to bottom of thread on load", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
for (let i = 1; i <= 25; i++) {
pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
}
@@ -119,16 +119,16 @@ QUnit.test("auto-scroll to bottom of thread on load", async (assert) => {
QUnit.test("display day separator before first message of the day", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "" });
pyEnv["mail.message"].create([
{
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
{
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
]);
@@ -139,10 +139,10 @@ QUnit.test("display day separator before first message of the day", async (asser
QUnit.test("do not display day separator if all messages of the day are empty", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "" });
pyEnv["mail.message"].create({
body: "",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const { openDiscuss } = await start();
@@ -154,8 +154,8 @@ QUnit.test(
"scroll position is kept when navigating from one channel to another",
async (assert) => {
const pyEnv = await startServer();
- const channelId_1 = pyEnv["mail.channel"].create({ name: "channel-1" });
- const channelId_2 = pyEnv["mail.channel"].create({ name: "channel-2" });
+ const channelId_1 = pyEnv["discuss.channel"].create({ name: "channel-1" });
+ const channelId_2 = pyEnv["discuss.channel"].create({ name: "channel-2" });
// Fill both channels with random messages in order for the scrollbar to
// appear.
pyEnv["mail.message"].create(
@@ -164,7 +164,7 @@ QUnit.test(
.map((_, index) => ({
body: "Non Empty Body ".repeat(25),
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: index & 1 ? channelId_1 : channelId_2,
}))
);
@@ -184,14 +184,14 @@ QUnit.test(
QUnit.test("thread is still scrolling after scrolling up then to bottom", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "channel-1" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "channel-1" });
pyEnv["mail.message"].create(
Array(20)
.fill(0)
.map(() => ({
body: "Non Empty Body ".repeat(25),
message_type: "comment",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
}))
);
@@ -206,7 +206,7 @@ QUnit.test("thread is still scrolling after scrolling up then to bottom", async
QUnit.test("mention a channel with space in the name", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General good boy" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General good boy" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await insertText(".o-mail-Composer-input", "#");
@@ -218,7 +218,7 @@ QUnit.test("mention a channel with space in the name", async (assert) => {
QUnit.test('mention a channel with "&" in the name', async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General & good" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General & good" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await insertText(".o-mail-Composer-input", "#");
@@ -237,7 +237,7 @@ QUnit.test(
name: "Fred",
});
const userId = pyEnv["res.users"].create({ partner_id: partnerId });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
uuid: "uuid-uuid",
channel_member_ids: [
@@ -250,9 +250,9 @@ QUnit.test(
mockRPC(route, args) {
if (args.method === "channel_fetched") {
assert.strictEqual(args.args[0][0], channelId);
- assert.strictEqual(args.model, "mail.channel");
+ assert.strictEqual(args.model, "discuss.channel");
assert.step("rpc:channel_fetch");
- } else if (route === "/mail/channel/set_last_seen_message") {
+ } else if (route === "/discuss/channel/set_last_seen_message") {
assert.strictEqual(args.channel_id, channelId);
assert.step("rpc:set_last_seen_message");
}
@@ -280,7 +280,7 @@ QUnit.test(
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({});
const userId = pyEnv["res.users"].create({ partner_id: partnerId });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
uuid: "uuid-uuid",
});
@@ -291,7 +291,7 @@ QUnit.test(
throw new Error(
"'channel_fetched' RPC must not be called for created channel as message is directly seen"
);
- } else if (route === "/mail/channel/set_last_seen_message") {
+ } else if (route === "/discuss/channel/set_last_seen_message") {
assert.strictEqual(args.channel_id, channelId);
assert.step("rpc:set_last_seen_message");
await deferred;
@@ -317,11 +317,11 @@ QUnit.test(
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Foreigner partner" });
const userId = pyEnv["res.users"].create({ name: "Foreigner user", partner_id: partnerId });
- const channelId = pyEnv["mail.channel"].create({ uuid: "channel-uuid" });
+ const channelId = pyEnv["discuss.channel"].create({ uuid: "channel-uuid" });
for (let i = 0; i <= 10; i++) {
pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
}
@@ -348,11 +348,11 @@ QUnit.test(
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Foreigner partner" });
const userId = pyEnv["res.users"].create({ name: "Foreigner user", partner_id: partnerId });
- const channelId = pyEnv["mail.channel"].create({ uuid: "channel-uuid" });
+ const channelId = pyEnv["discuss.channel"].create({ uuid: "channel-uuid" });
for (let i = 0; i <= 10; i++) {
pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
}
@@ -379,7 +379,7 @@ QUnit.test(
QUnit.test("show empty placeholder when thread contains no message", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "general" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "general" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
assert.containsOnce($, ".o-mail-Thread:contains(There are no messages in this conversation.)");
@@ -388,8 +388,8 @@ QUnit.test("show empty placeholder when thread contains no message", async (asse
QUnit.test("show empty placeholder when thread contains only empty messages", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
- pyEnv["mail.message"].create({ model: "mail.channel", res_id: channelId });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
+ pyEnv["mail.message"].create({ model: "discuss.channel", res_id: channelId });
const { openDiscuss } = await start();
await openDiscuss(channelId);
assert.containsOnce($, ".o-mail-Thread:contains(There are no messages in this conversation.)");
@@ -400,20 +400,20 @@ QUnit.test(
"message list with a full page of empty messages should load more messages until there are some non-empty",
async (assert) => {
// Technical assumptions :
- // - /mail/channel/messages fetching exactly 30 messages,
+ // - /discuss/channel/messages fetching exactly 30 messages,
// - empty messages not being displayed
// - auto-load more being triggered on scroll, not automatically when the 30 first messages are empty
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
for (let i = 0; i < 50; i++) {
pyEnv["mail.message"].create({
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
}
for (let i = 0; i < 50; i++) {
- pyEnv["mail.message"].create({ model: "mail.channel", res_id: channelId });
+ pyEnv["mail.message"].create({ model: "discuss.channel", res_id: channelId });
}
const { openDiscuss } = await start();
await openDiscuss(channelId);
@@ -427,7 +427,7 @@ QUnit.test(
"no new messages separator on posting message (some message history)",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { message_unread_counter: 0, partner_id: pyEnv.currentPartnerId }],
],
@@ -436,14 +436,14 @@ QUnit.test(
});
const messageId = pyEnv["mail.message"].create({
body: "first message",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
- const [memberId] = pyEnv["mail.channel.member"].search([
+ const [memberId] = pyEnv["discuss.channel.member"].search([
["channel_id", "=", channelId],
["partner_id", "=", pyEnv.currentPartnerId],
]);
- pyEnv["mail.channel.member"].write([memberId], { seen_message_id: messageId });
+ pyEnv["discuss.channel.member"].write([memberId], { seen_message_id: messageId });
const { openDiscuss } = await start();
await openDiscuss(channelId);
assert.containsOnce($, ".o-mail-Message");
@@ -468,7 +468,7 @@ QUnit.test("new messages separator on receiving new message [REQUIRE FOCUS]", as
name: "Foreigner user",
partner_id: partnerId,
});
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { message_unread_counter: 0, partner_id: pyEnv.currentPartnerId }],
],
@@ -478,14 +478,14 @@ QUnit.test("new messages separator on receiving new message [REQUIRE FOCUS]", as
});
const messageId = pyEnv["mail.message"].create({
body: "blah",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
- const [memberId] = pyEnv["mail.channel.member"].search([
+ const [memberId] = pyEnv["discuss.channel.member"].search([
["channel_id", "=", channelId],
["partner_id", "=", pyEnv.currentPartnerId],
]);
- pyEnv["mail.channel.member"].write([memberId], { seen_message_id: messageId });
+ pyEnv["discuss.channel.member"].write([memberId], { seen_message_id: messageId });
const { env, openDiscuss } = await start();
await openDiscuss(channelId);
assert.containsOnce($, ".o-mail-Message", "should have an initial message");
@@ -511,7 +511,7 @@ QUnit.test("new messages separator on receiving new message [REQUIRE FOCUS]", as
QUnit.test("no new messages separator on posting message (no message history)", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { message_unread_counter: 0, partner_id: pyEnv.currentPartnerId }],
],
@@ -535,7 +535,7 @@ QUnit.test("Mention a partner with special character (e.g. apostrophe ')", async
email: "usatyi@example.com",
name: "Pynya's spokesman",
});
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -566,7 +566,7 @@ QUnit.test("mention 2 different partners that have the same name", async (assert
name: "TestPartner",
},
]);
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -596,7 +596,7 @@ QUnit.test("mention 2 different partners that have the same name", async (assert
QUnit.test("mention a channel on a second line when the first line contains #", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General good" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General good" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await insertText(".o-mail-Composer-input", "#blabla\n");
@@ -611,7 +611,7 @@ QUnit.test(
"mention a channel when replacing the space after the mention by another char",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General good" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General good" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await insertText(".o-mail-Composer-input", "#");
@@ -627,7 +627,7 @@ QUnit.test(
QUnit.test("mention 2 different channels that have the same name", async (assert) => {
const pyEnv = await startServer();
- const [channelId_1, channelId_2] = pyEnv["mail.channel"].create([
+ const [channelId_1, channelId_2] = pyEnv["discuss.channel"].create([
{
channel_type: "channel",
group_public_id: false,
@@ -650,11 +650,11 @@ QUnit.test("mention 2 different channels that have the same name", async (assert
assert.containsOnce($, ".o-mail-Message-body");
assert.containsOnce(
$(".o-mail-Message-body"),
- `.o_channel_redirect[data-oe-id="${channelId_1}"][data-oe-model="mail.channel"]:contains("#my channel")`
+ `.o_channel_redirect[data-oe-id="${channelId_1}"][data-oe-model="discuss.channel"]:contains("#my channel")`
);
assert.containsOnce(
$(".o-mail-Message-body"),
- `.o_channel_redirect[data-oe-id="${channelId_2}"][data-oe-model="mail.channel"]:contains("#my channel")`
+ `.o_channel_redirect[data-oe-id="${channelId_2}"][data-oe-model="discuss.channel"]:contains("#my channel")`
);
});
@@ -666,7 +666,7 @@ QUnit.test(
email: "testpartner@odoo.com",
name: "TestPartner",
});
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
name: "test",
channel_member_ids: [
[0, 0, { partner_id: pyEnv.currentPartnerId }],
@@ -689,12 +689,12 @@ QUnit.test(
QUnit.test("basic rendering of canceled notification", async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "test" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "test" });
const partnerId = pyEnv["res.partner"].create({ name: "Someone" });
const messageId = pyEnv["mail.message"].create({
body: "not empty",
message_type: "email",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
pyEnv["mail.notification"].create({
@@ -728,7 +728,7 @@ QUnit.test(
name: "Foreigner user",
partner_id: partnerId,
});
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_type: "channel",
name: "General",
uuid: "channel20uuid",
@@ -736,7 +736,7 @@ QUnit.test(
pyEnv["mail.message"].create([
{
body: "not empty",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
},
]);
@@ -765,7 +765,7 @@ QUnit.test(
"composer should be focused automatically after clicking on the send button",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "test" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "test" });
const { openDiscuss } = await start();
await openDiscuss(channelId);
await insertText(".o-mail-Composer-input", "Dummy Message");
@@ -844,10 +844,10 @@ QUnit.test(
QUnit.test("Thread messages are only loaded once", async (assert) => {
const pyEnv = await startServer();
- const channelIds = pyEnv["mail.channel"].create([{ name: "General" }, { name: "Sales" }]);
+ const channelIds = pyEnv["discuss.channel"].create([{ name: "General" }, { name: "Sales" }]);
const { openDiscuss } = await start({
mockRPC(route, args, originalRPC) {
- if (route === "/mail/channel/messages") {
+ if (route === "/discuss/channel/messages") {
assert.step(`load messages - ${args["channel_id"]}`);
}
return originalRPC(route, args);
@@ -855,12 +855,12 @@ QUnit.test("Thread messages are only loaded once", async (assert) => {
});
pyEnv["mail.message"].create([
{
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelIds[0],
body: "Message on channel1",
},
{
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelIds[1],
body: "Message on channel2",
},
@@ -879,14 +879,14 @@ QUnit.test(
"Opening thread with needaction messages should mark all messages of thread as read",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
const { env, openDiscuss } = await start({
mockRPC(route, args) {
if (args.model === "mail.message" && args.method === "mark_all_as_read") {
assert.step("mark-all-messages-as-read");
assert.deepEqual(args.args[0], [
- ["model", "=", "mail.channel"],
+ ["model", "=", "discuss.channel"],
["res_id", "=", channelId],
]);
}
@@ -900,7 +900,7 @@ QUnit.test(
author_id: partnerId,
body: "@Mitchel Admin",
needaction: true,
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
needaction_partner_ids: [pyEnv.currentPartnerId],
});
@@ -914,7 +914,7 @@ QUnit.test(
const [formattedMessage] = await env.services.orm.call("mail.message", "message_format", [
[messageId],
]);
- pyEnv["bus.bus"]._sendone(pyEnv.currentPartner, "mail.channel/new_message", {
+ pyEnv["bus.bus"]._sendone(pyEnv.currentPartner, "discuss.channel/new_message", {
id: channelId,
message: formattedMessage,
});
@@ -931,7 +931,7 @@ QUnit.test(
"[technical] Opening thread without needaction messages should not mark all messages of thread as read",
async (assert) => {
const pyEnv = await startServer();
- const channelId = pyEnv["mail.channel"].create({ name: "General" });
+ const channelId = pyEnv["discuss.channel"].create({ name: "General" });
const { env, openDiscuss } = await start({
mockRPC(route, args) {
if (args.model === "mail.message" && args.method === "mark_all_as_read") {
@@ -947,7 +947,7 @@ QUnit.test(
attachment_ids: [],
},
thread_id: channelId,
- thread_model: "mail.channel",
+ thread_model: "discuss.channel",
});
await click("button:contains(General)");
await nextTick();
@@ -958,7 +958,7 @@ QUnit.test(
QUnit.test("can be marked as read while loading", async function (assert) {
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
- const channelId = pyEnv["mail.channel"].create({
+ const channelId = pyEnv["discuss.channel"].create({
channel_member_ids: [
[0, 0, { message_unread_counter: 1, partner_id: pyEnv.currentPartnerId }],
[0, 0, { partner_id: partnerId }],
@@ -968,13 +968,13 @@ QUnit.test("can be marked as read while loading", async function (assert) {
pyEnv["mail.message"].create({
author_id: partnerId,
body: "
Test
",
- model: "mail.channel",
+ model: "discuss.channel",
res_id: channelId,
});
const loadDeferred = makeDeferred();
const { openDiscuss } = await start({
async mockRPC(route) {
- if (route === "/mail/channel/messages") {
+ if (route === "/discuss/channel/messages") {
await loadDeferred;
}
},
diff --git a/addons/mail/static/tests/tours/discuss_channel_as_guest_tour.js b/addons/mail/static/tests/tours/discuss_channel_as_guest_tour.js
new file mode 100644
index 00000000000..e04193bb5b0
--- /dev/null
+++ b/addons/mail/static/tests/tours/discuss_channel_as_guest_tour.js
@@ -0,0 +1,87 @@
+/** @odoo-module **/
+
+import { registry } from "@web/core/registry";
+import { createFile, inputFiles } from "web.test_utils_file";
+
+registry
+ .category("web_tour.tours")
+ .add("mail/static/tests/tours/discuss_channel_as_guest_tour.js", {
+ test: true,
+ steps: [
+ {
+ content: "Channel secret token has been hidden on welcome page",
+ trigger: ".o-mail-WelcomePage",
+ run() {
+ if (!window.location.pathname.startsWith("/discuss/channel")) {
+ console.error("Channel secret token is still present in URL.");
+ }
+ },
+ },
+ {
+ content: "Click join",
+ trigger: "button[title='Join Channel']",
+ extraTrigger: ".o-mail-Thread",
+ },
+ {
+ content: "Check that we are on channel page",
+ trigger: ".o-mail-Thread",
+ run() {
+ // Wait for modules to be loaded or failed for the next step
+ odoo.__DEBUG__.didLogInfo.then(() => {
+ const { missing, failed, unloaded } = odoo.__DEBUG__.jsModules;
+ if ([missing, failed, unloaded].some((arr) => arr.length)) {
+ console.error(
+ "Couldn't load all JS modules.",
+ JSON.stringify({ missing, failed, unloaded })
+ );
+ }
+ document.body.classList.add(
+ "o_discuss_channel_as_guest_tour_modules_loaded"
+ );
+ });
+ },
+ extraTrigger: ".o_discuss_channel_as_guest_tour_modules_loaded",
+ },
+ {
+ content: "Wait for all modules loaded check in previous step",
+ trigger: ".o_discuss_channel_as_guest_tour_modules_loaded",
+ },
+ {
+ content: "Write something in composer",
+ trigger: ".o-mail-Composer-input",
+ run: "text cheese",
+ },
+ {
+ content: "Add one file in composer",
+ trigger: ".o-mail-Composer button[aria-label='Attach files']",
+ async run() {
+ const file = await createFile({
+ content: "hello, world",
+ contentType: "text/plain",
+ name: "text.txt",
+ });
+ inputFiles(document.querySelector(".o-mail-Composer-coreMain .o_input_file"), [
+ file,
+ ]);
+ },
+ },
+ {
+ content: "Check the earlier provided attachment is listed",
+ trigger: '.o-mail-AttachmentCard[title="text.txt"]',
+ extra_trigger: ".o-mail-AttachmentCard:not(.o-isUploading)", // waiting the attachment to be uploaded
+ run() {},
+ },
+ {
+ content: "Send message",
+ trigger: ".o-mail-Composer-send",
+ },
+ {
+ content: "Check message is shown",
+ trigger: '.o-mail-Message-body:contains("cheese")',
+ },
+ {
+ content: "Check message contains the attachment",
+ trigger: '.o-mail-Message .o-mail-AttachmentCard:contains("text.txt")',
+ },
+ ],
+ });
diff --git a/addons/mail/static/tests/tours/discuss_public_tour.js b/addons/mail/static/tests/tours/discuss_public_tour.js
index fc2bce4f59b..ea421df57bc 100644
--- a/addons/mail/static/tests/tours/discuss_public_tour.js
+++ b/addons/mail/static/tests/tours/discuss_public_tour.js
@@ -26,14 +26,14 @@ registry.category("web_tour.tours").add("mail/static/tests/tours/discuss_public_
JSON.stringify({ missing, failed, unloaded })
);
}
- document.body.classList.add("o_mail_channel_public_modules_loaded");
+ document.body.classList.add("o_discuss_channel_public_modules_loaded");
});
},
- extraTrigger: ".o_mail_channel_public_modules_loaded",
+ extraTrigger: ".o_discuss_channel_public_modules_loaded",
},
{
content: "Wait for all modules loaded check in previous step",
- trigger: ".o_mail_channel_public_modules_loaded",
+ trigger: ".o_discuss_channel_public_modules_loaded",
},
{
content: "Write something in composer",
diff --git a/addons/mail/static/tests/tours/mail_channel_as_guest_tour.js b/addons/mail/static/tests/tours/mail_channel_as_guest_tour.js
deleted file mode 100644
index b44a59e013c..00000000000
--- a/addons/mail/static/tests/tours/mail_channel_as_guest_tour.js
+++ /dev/null
@@ -1,83 +0,0 @@
-/** @odoo-module **/
-
-import { registry } from "@web/core/registry";
-import { createFile, inputFiles } from "web.test_utils_file";
-
-registry.category("web_tour.tours").add("mail/static/tests/tours/mail_channel_as_guest_tour.js", {
- test: true,
- steps: [
- {
- content: "Channel secret token has been hidden on welcome page",
- trigger: ".o-mail-WelcomePage",
- run() {
- if (!window.location.pathname.startsWith("/discuss/channel")) {
- console.error("Channel secret token is still present in URL.");
- }
- },
- },
- {
- content: "Click join",
- trigger: "button[title='Join Channel']",
- extraTrigger: ".o-mail-Thread",
- },
- {
- content: "Check that we are on channel page",
- trigger: ".o-mail-Thread",
- run() {
- // Wait for modules to be loaded or failed for the next step
- odoo.__DEBUG__.didLogInfo.then(() => {
- const { missing, failed, unloaded } = odoo.__DEBUG__.jsModules;
- if ([missing, failed, unloaded].some((arr) => arr.length)) {
- console.error(
- "Couldn't load all JS modules.",
- JSON.stringify({ missing, failed, unloaded })
- );
- }
- document.body.classList.add("o_mail_channel_as_guest_tour_modules_loaded");
- });
- },
- extraTrigger: ".o_mail_channel_as_guest_tour_modules_loaded",
- },
- {
- content: "Wait for all modules loaded check in previous step",
- trigger: ".o_mail_channel_as_guest_tour_modules_loaded",
- },
- {
- content: "Write something in composer",
- trigger: ".o-mail-Composer-input",
- run: "text cheese",
- },
- {
- content: "Add one file in composer",
- trigger: ".o-mail-Composer button[aria-label='Attach files']",
- async run() {
- const file = await createFile({
- content: "hello, world",
- contentType: "text/plain",
- name: "text.txt",
- });
- inputFiles(document.querySelector(".o-mail-Composer-coreMain .o_input_file"), [
- file,
- ]);
- },
- },
- {
- content: "Check the earlier provided attachment is listed",
- trigger: '.o-mail-AttachmentCard[title="text.txt"]',
- extra_trigger: ".o-mail-AttachmentCard:not(.o-isUploading)", // waiting the attachment to be uploaded
- run() {},
- },
- {
- content: "Send message",
- trigger: ".o-mail-Composer-send",
- },
- {
- content: "Check message is shown",
- trigger: '.o-mail-Message-body:contains("cheese")',
- },
- {
- content: "Check message contains the attachment",
- trigger: '.o-mail-Message .o-mail-AttachmentCard:contains("text.txt")',
- },
- ],
-});
diff --git a/addons/mail/static/tests/web/command_palette_tests.js b/addons/mail/static/tests/web/command_palette_tests.js
index ecfd0700aa6..d5c22d64ed7 100644
--- a/addons/mail/static/tests/web/command_palette_tests.js
+++ b/addons/mail/static/tests/web/command_palette_tests.js
@@ -29,8 +29,8 @@ QUnit.test("open the chatWindow of a user from the command palette", async (asse
QUnit.test("open the chatWindow of a channel from the command palette", async (assert) => {
const pyEnv = await startServer();
- pyEnv["mail.channel"].create({ name: "general" });
- pyEnv["mail.channel"].create({ name: "project" });
+ pyEnv["discuss.channel"].create({ name: "general" });
+ pyEnv["discuss.channel"].create({ name: "project" });
const { advanceTime } = await start({ hasTimeControl: true });
triggerHotkey("control+k");
await nextTick();
diff --git a/addons/mail/tests/__init__.py b/addons/mail/tests/__init__.py
index 5055175af08..f8c699dffc3 100644
--- a/addons/mail/tests/__init__.py
+++ b/addons/mail/tests/__init__.py
@@ -2,9 +2,9 @@
from . import test_get_model_definitions
from . import test_link_preview
-from . import test_mail_channel
-from . import test_mail_channel_as_guest
-from . import test_mail_channel_member
+from . import test_discuss_channel
+from . import test_discuss_channel_as_guest
+from . import test_discuss_channel_member
from . import test_mail_composer
from . import test_mail_full_composer
from . import test_mail_render
diff --git a/addons/mail/tests/common.py b/addons/mail/tests/common.py
index 936725b81d1..fbd1a7e70c6 100644
--- a/addons/mail/tests/common.py
+++ b/addons/mail/tests/common.py
@@ -27,7 +27,7 @@ mail_new_test_user = partial(new_test_user, context={'mail_create_nolog': True,
'mail_create_nosubscribe': True,
'mail_notrack': True,
'no_reset_password': True,
- 'mail_channel_nosubscribe': True})
+ 'discuss_channel_nosubscribe': True})
class MockEmail(common.BaseCase, MockSmtplibCase):
@@ -626,7 +626,7 @@ class MailCase(MockEmail):
("UNKNOWN", "Unknown error")
"""
_test_context = {
- 'mail_channel_nosubscribe': True,
+ 'discuss_channel_nosubscribe': True,
'mail_create_nolog': True,
'mail_create_nosubscribe': True,
'mail_notrack': True,
@@ -960,7 +960,7 @@ class MailCase(MockEmail):
EXPECTED
:param channels: list of expected bus channels, like [
- (self.cr.dbname, 'mail.channel', self.channel_1.id),
+ (self.cr.dbname, 'discuss.channel', self.channel_1.id),
(self.cr.dbname, 'res.partner', self.partner_employee_2.id)
]
:param message_items: if given, list of expected message making a valid
diff --git a/addons/mail/tests/test_mail_channel.py b/addons/mail/tests/test_discuss_channel.py
similarity index 71%
rename from addons/mail/tests/test_mail_channel.py
rename to addons/mail/tests/test_discuss_channel.py
index bb626b3f1f8..67313f6d2ff 100644
--- a/addons/mail/tests/test_mail_channel.py
+++ b/addons/mail/tests/test_discuss_channel.py
@@ -6,7 +6,7 @@ from datetime import datetime
from unittest.mock import patch
from odoo import Command, fields
-from odoo.addons.mail.models.mail_channel import channel_avatar, group_avatar
+from odoo.addons.mail.models.discuss_channel import channel_avatar, group_avatar
from odoo.addons.mail.tests.common import mail_new_test_user
from odoo.addons.mail.tests.common import MailCommon
from odoo.exceptions import AccessError, UserError
@@ -16,7 +16,6 @@ from odoo.tools import html_escape, mute_logger
from odoo.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT
-@tagged('mail_channel')
class TestChannelAccessRights(MailCommon):
@classmethod
@@ -28,29 +27,29 @@ class TestChannelAccessRights(MailCommon):
cls.user_portal = mail_new_test_user(cls.env, login='user_portal', groups='base.group_portal', name='Chell Gladys')
# Channel for certain group
- cls.group_restricted_channel = cls.env['mail.channel'].browse(cls.env['mail.channel'].channel_create(name='Channel for Groups', group_id=cls.env.ref('base.group_user').id)['id'])
+ cls.group_restricted_channel = cls.env['discuss.channel'].browse(cls.env['discuss.channel'].channel_create(name='Channel for Groups', group_id=cls.env.ref('base.group_user').id)['id'])
# Public Channel
- cls.public_channel = cls.env['mail.channel'].browse(cls.env['mail.channel'].channel_create(name='Public Channel', group_id=None)['id'])
+ cls.public_channel = cls.env['discuss.channel'].browse(cls.env['discuss.channel'].channel_create(name='Public Channel', group_id=None)['id'])
# Group
- cls.private_group = cls.env['mail.channel'].browse(cls.env['mail.channel'].create_group(partners_to=cls.user_employee.partner_id.ids, name="Group")['id'])
+ cls.private_group = cls.env['discuss.channel'].browse(cls.env['discuss.channel'].create_group(partners_to=cls.user_employee.partner_id.ids, name="Group")['id'])
# Chat
- cls.chat_user_employee = cls.env['mail.channel'].browse(cls.env['mail.channel'].channel_get(cls.user_employee.partner_id.ids)['id'])
- cls.chat_user_employee_1 = cls.env['mail.channel'].browse(cls.env['mail.channel'].channel_get(cls.user_employee_1.partner_id.ids)['id'])
- cls.chat_user_portal = cls.env['mail.channel'].browse(cls.env['mail.channel'].channel_get(cls.user_portal.partner_id.ids)['id'])
- cls.chat_user_public = cls.env['mail.channel'].browse(cls.env['mail.channel'].channel_get(cls.user_public.partner_id.ids)['id'])
+ cls.chat_user_employee = cls.env['discuss.channel'].browse(cls.env['discuss.channel'].channel_get(cls.user_employee.partner_id.ids)['id'])
+ cls.chat_user_employee_1 = cls.env['discuss.channel'].browse(cls.env['discuss.channel'].channel_get(cls.user_employee_1.partner_id.ids)['id'])
+ cls.chat_user_portal = cls.env['discuss.channel'].browse(cls.env['discuss.channel'].channel_get(cls.user_portal.partner_id.ids)['id'])
+ cls.chat_user_public = cls.env['discuss.channel'].browse(cls.env['discuss.channel'].channel_get(cls.user_public.partner_id.ids)['id'])
@mute_logger('odoo.addons.base.models.ir_rule', 'odoo.addons.base.models.ir_model', 'odoo.models')
@users('user_public')
def test_access_public(self):
# Read public channel -> ok
- self.env['mail.channel'].browse(self.public_channel.id).read()
+ self.env['discuss.channel'].browse(self.public_channel.id).read()
# Read group restricted channel -> ko, no access rights
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.group_restricted_channel.id).read()
+ self.env['discuss.channel'].browse(self.group_restricted_channel.id).read()
# Read group -> ko, no access rights
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.private_group.id).read()
+ self.env['discuss.channel'].browse(self.private_group.id).read()
# Being a member of public channel: -> ok
self.public_channel.add_members(self.user_public.partner_id.id)
@@ -62,53 +61,53 @@ class TestChannelAccessRights(MailCommon):
# Read a group when being a member: -> ko, no access rights
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.private_group.id).read()
+ self.env['discuss.channel'].browse(self.private_group.id).read()
# Read a chat when being a member: -> ko, no access rights
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.chat_user_public.id).read()
+ self.env['discuss.channel'].browse(self.chat_user_public.id).read()
# Create channel/group/chat: ko, no access rights
with self.assertRaises(AccessError):
- self.env['mail.channel'].create({'name': 'Test', 'channel_type': 'channel'})
+ self.env['discuss.channel'].create({'name': 'Test', 'channel_type': 'channel'})
with self.assertRaises(AccessError):
- self.env['mail.channel'].create({'name': 'Test', 'channel_type': 'group'})
+ self.env['discuss.channel'].create({'name': 'Test', 'channel_type': 'group'})
with self.assertRaises(AccessError):
- self.env['mail.channel'].create({'name': 'Test', 'channel_type': 'chat'})
+ self.env['discuss.channel'].create({'name': 'Test', 'channel_type': 'chat'})
# Update channel/group/chat: ko, no access rights
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.public_channel.id).write({'name': 'modified'})
+ self.env['discuss.channel'].browse(self.public_channel.id).write({'name': 'modified'})
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.group_restricted_channel.id).write({'name': 'modified'})
+ self.env['discuss.channel'].browse(self.group_restricted_channel.id).write({'name': 'modified'})
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.private_group.id).write({'name': 'modified'})
+ self.env['discuss.channel'].browse(self.private_group.id).write({'name': 'modified'})
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.chat_user_public.id).write({'name': 'modified'})
+ self.env['discuss.channel'].browse(self.chat_user_public.id).write({'name': 'modified'})
# Unlink channel/group/chat: ko, no access rights
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.public_channel.id).unlink()
+ self.env['discuss.channel'].browse(self.public_channel.id).unlink()
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.group_restricted_channel.id).unlink()
+ self.env['discuss.channel'].browse(self.group_restricted_channel.id).unlink()
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.private_group.id).unlink()
+ self.env['discuss.channel'].browse(self.private_group.id).unlink()
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.chat_user_public.id).unlink()
+ self.env['discuss.channel'].browse(self.chat_user_public.id).unlink()
@mute_logger('odoo.addons.base.models.ir_rule', 'odoo.addons.base.models.ir_model', 'odoo.models')
@users('employee')
def test_access_employee(self):
# Read public channel -> ok
- self.env['mail.channel'].browse(self.public_channel.id).read()
+ self.env['discuss.channel'].browse(self.public_channel.id).read()
# Read group restricted channel -> ok
- self.env['mail.channel'].browse(self.group_restricted_channel.id).read()
+ self.env['discuss.channel'].browse(self.group_restricted_channel.id).read()
# Read chat when not being a member: ko, no access rights
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.chat_user_employee_1.id).read()
+ self.env['discuss.channel'].browse(self.chat_user_employee_1.id).read()
# Update chat when not being a member: ko, no access rights
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.chat_user_employee_1.id).write({'name': 'modified'})
+ self.env['discuss.channel'].browse(self.chat_user_employee_1.id).write({'name': 'modified'})
# Being a channel/group member: -> ok
self.public_channel.add_members(self.user_public.partner_id.id)
@@ -116,22 +115,22 @@ class TestChannelAccessRights(MailCommon):
self.private_group.add_members(self.env.user.partner_id.id)
# Read a group when being a member: ok
- self.env['mail.channel'].browse(self.private_group.id).read()
+ self.env['discuss.channel'].browse(self.private_group.id).read()
# Read a chat when being a member: ok
- self.env['mail.channel'].browse(self.chat_user_employee.id).read()
+ self.env['discuss.channel'].browse(self.chat_user_employee.id).read()
# Update channel/group/chat when being a member: ok
- self.env['mail.channel'].browse(self.public_channel.id).write({'name': 'modified again'})
- self.env['mail.channel'].browse(self.group_restricted_channel.id).write({'name': 'modified again'})
- self.env['mail.channel'].browse(self.private_group.id).write({'name': 'modified again'})
- self.env['mail.channel'].browse(self.chat_user_employee.id).write({'name': 'modified again'})
+ self.env['discuss.channel'].browse(self.public_channel.id).write({'name': 'modified again'})
+ self.env['discuss.channel'].browse(self.group_restricted_channel.id).write({'name': 'modified again'})
+ self.env['discuss.channel'].browse(self.private_group.id).write({'name': 'modified again'})
+ self.env['discuss.channel'].browse(self.chat_user_employee.id).write({'name': 'modified again'})
# Create channel/group/chat: ok
- new_channel = self.env['mail.channel'].create(
+ new_channel = self.env['discuss.channel'].create(
{'name': 'Test', 'channel_type': 'channel'})
- new_group = self.env['mail.channel'].create(
+ new_group = self.env['discuss.channel'].create(
{'name': 'Test', 'channel_type': 'group'})
- new_chat = self.env['mail.channel'].create(
+ new_chat = self.env['discuss.channel'].create(
{'name': 'Test', 'channel_type': 'chat'})
# Employee should be inside the created chat/group/chat
@@ -141,55 +140,55 @@ class TestChannelAccessRights(MailCommon):
# Unlink channel/group/chat: ko, no access rights
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.public_channel.id).unlink()
+ self.env['discuss.channel'].browse(self.public_channel.id).unlink()
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.group_restricted_channel.id).unlink()
+ self.env['discuss.channel'].browse(self.group_restricted_channel.id).unlink()
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.private_group.id).unlink()
+ self.env['discuss.channel'].browse(self.private_group.id).unlink()
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.chat_user_employee.id).unlink()
+ self.env['discuss.channel'].browse(self.chat_user_employee.id).unlink()
@mute_logger('odoo.addons.base.models.ir_rule', 'odoo.addons.base.models.ir_model', 'odoo.models')
@users('user_portal')
def test_access_portal(self):
# Read public channel -> ok
- self.env['mail.channel'].browse(self.public_channel.id).read()
+ self.env['discuss.channel'].browse(self.public_channel.id).read()
# Read group restricted channel/group -> ko, no access rights
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.group_restricted_channel.id).read()
+ self.env['discuss.channel'].browse(self.group_restricted_channel.id).read()
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.private_group.id).read()
+ self.env['discuss.channel'].browse(self.private_group.id).read()
# Being a group member: -> ok
self.private_group.add_members(self.user_portal.partner_id.id)
# Read a group/chat when being a member: ok
- self.env['mail.channel'].browse(self.private_group.id).read()
- self.env['mail.channel'].browse(self.chat_user_portal.id).read()
+ self.env['discuss.channel'].browse(self.private_group.id).read()
+ self.env['discuss.channel'].browse(self.chat_user_portal.id).read()
# Update group/chat when being a member: ko, no access rights
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.private_group.id).write({'name': 'modified'})
+ self.env['discuss.channel'].browse(self.private_group.id).write({'name': 'modified'})
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.chat_user_portal.id).write({'name': 'modified'})
+ self.env['discuss.channel'].browse(self.chat_user_portal.id).write({'name': 'modified'})
# Create group/chat: ko, no access rights
with self.assertRaises(AccessError):
- self.env['mail.channel'].create({'name': 'Test', 'channel_type': 'group'})
+ self.env['discuss.channel'].create({'name': 'Test', 'channel_type': 'group'})
with self.assertRaises(AccessError):
- self.env['mail.channel'].create({'name': 'Test', 'channel_type': 'chat'})
+ self.env['discuss.channel'].create({'name': 'Test', 'channel_type': 'chat'})
# Unlink group/chat: ko, no access rights
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.private_group.id).unlink()
+ self.env['discuss.channel'].browse(self.private_group.id).unlink()
with self.assertRaises(AccessError):
- self.env['mail.channel'].browse(self.chat_user_portal.id).unlink()
+ self.env['discuss.channel'].browse(self.chat_user_portal.id).unlink()
# Read message from group/chat: ok
- group_portal = self.env['mail.channel'].browse(self.private_group.id)
+ group_portal = self.env['discuss.channel'].browse(self.private_group.id)
for message in group_portal.message_ids:
message.read(['subject'])
- chat_portal = self.env['mail.channel'].browse(self.chat_user_portal.id)
+ chat_portal = self.env['discuss.channel'].browse(self.chat_user_portal.id)
for message in chat_portal.message_ids:
message.read(['subject'])
@@ -214,13 +213,12 @@ class TestChannelAccessRights(MailCommon):
partner.with_user(self.user_portal).name
-@tagged('mail_channel')
class TestChannelInternals(MailCommon):
@classmethod
def setUpClass(cls):
super(TestChannelInternals, cls).setUpClass()
- cls.test_channel = cls.env['mail.channel'].browse(cls.env['mail.channel'].with_context(cls._test_context).channel_create(name='Channel', group_id=None)['id'])
+ cls.test_channel = cls.env['discuss.channel'].browse(cls.env['discuss.channel'].with_context(cls._test_context).channel_create(name='Channel', group_id=None)['id'])
cls.test_partner = cls.env['res.partner'].with_context(cls._test_context).create({
'name': 'Test Partner',
'email': 'test_customer@example.com',
@@ -238,7 +236,7 @@ class TestChannelInternals(MailCommon):
@users('employee')
def test_channel_members(self):
- channel = self.env['mail.channel'].browse(self.test_channel.ids)
+ channel = self.env['discuss.channel'].browse(self.test_channel.ids)
self.assertEqual(channel.message_partner_ids, self.env['res.partner'])
self.assertEqual(channel.channel_partner_ids, self.env['res.partner'])
@@ -246,7 +244,7 @@ class TestChannelInternals(MailCommon):
self.assertEqual(channel.message_partner_ids, self.env['res.partner'])
self.assertEqual(channel.channel_partner_ids, self.test_partner)
- self.env['mail.channel.member'].sudo().search([
+ self.env['discuss.channel.member'].sudo().search([
('partner_id', 'in', self.test_partner.ids),
('channel_id', 'in', channel.ids)
]).unlink()
@@ -260,18 +258,18 @@ class TestChannelInternals(MailCommon):
@users('employee')
@mute_logger('odoo.addons.mail.models.mail_mail', 'odoo.models.unlink')
def test_channel_chat_message_post_should_update_last_interest_dt(self):
- channel_info = self.env['mail.channel'].with_user(self.user_admin).channel_get((self.partner_employee | self.user_admin.partner_id).ids)
- chat = self.env['mail.channel'].with_user(self.user_admin).browse(channel_info['id'])
+ channel_info = self.env['discuss.channel'].with_user(self.user_admin).channel_get((self.partner_employee | self.user_admin.partner_id).ids)
+ chat = self.env['discuss.channel'].with_user(self.user_admin).browse(channel_info['id'])
post_time = fields.Datetime.now()
# Mocks the return value of field.Datetime.now(),
# so we can see if the `last_interest_dt` is updated correctly
with patch.object(fields.Datetime, 'now', lambda: post_time):
chat.message_post(body="Test", message_type='comment', subtype_xmlid='mail.mt_comment')
- channel_member_employee = self.env['mail.channel.member'].search([
+ channel_member_employee = self.env['discuss.channel.member'].search([
('partner_id', '=', self.partner_employee.id),
('channel_id', '=', chat.id),
])
- channel_member_admin = self.env['mail.channel.member'].search([
+ channel_member_admin = self.env['discuss.channel.member'].search([
('partner_id', '=', self.partner_admin.id),
('channel_id', '=', chat.id),
])
@@ -282,7 +280,7 @@ class TestChannelInternals(MailCommon):
@mute_logger('odoo.addons.mail.models.mail_mail', 'odoo.models.unlink')
def test_channel_recipients_channel(self):
""" Posting a message on a channel should not send emails """
- channel = self.env['mail.channel'].browse(self.test_channel.ids)
+ channel = self.env['discuss.channel'].browse(self.test_channel.ids)
channel.add_members((self.partner_employee | self.partner_admin | self.test_partner).ids)
with self.mock_mail_gateway():
new_msg = channel.message_post(body="Test", message_type='comment', subtype_xmlid='mail.mt_comment')
@@ -296,8 +294,8 @@ class TestChannelInternals(MailCommon):
@mute_logger('odoo.addons.mail.models.mail_mail', 'odoo.models.unlink')
def test_channel_recipients_chat(self):
""" Posting a message on a chat should not send emails """
- channel_info = self.env['mail.channel'].with_user(self.user_admin).channel_get((self.partner_employee | self.user_admin.partner_id).ids)
- chat = self.env['mail.channel'].with_user(self.user_admin).browse(channel_info['id'])
+ channel_info = self.env['discuss.channel'].with_user(self.user_admin).channel_get((self.partner_employee | self.user_admin.partner_id).ids)
+ chat = self.env['discuss.channel'].with_user(self.user_admin).browse(channel_info['id'])
with self.mock_mail_gateway():
with self.with_user('employee'):
new_msg = chat.message_post(body="Test", message_type='comment', subtype_xmlid='mail.mt_comment')
@@ -319,7 +317,7 @@ class TestChannelInternals(MailCommon):
@mute_logger('odoo.models.unlink')
def test_channel_user_synchronize(self):
"""Archiving / deleting a user should automatically unsubscribe related partner from group restricted channels"""
- group_restricted_channel = self.env['mail.channel'].browse(self.env['mail.channel'].channel_create(name='Sic Mundus', group_id=self.env.ref('base.group_user').id)['id'])
+ group_restricted_channel = self.env['discuss.channel'].browse(self.env['discuss.channel'].channel_create(name='Sic Mundus', group_id=self.env.ref('base.group_user').id)['id'])
self.test_channel.add_members((self.partner_employee | self.partner_employee_nomail).ids)
group_restricted_channel.add_members((self.partner_employee | self.partner_employee_nomail).ids)
@@ -337,47 +335,47 @@ class TestChannelInternals(MailCommon):
@users('employee_nomail')
def test_channel_info_get(self):
# `channel_get` should return a new channel the first time a partner is given
- initial_channel_info = self.env['mail.channel'].channel_get(partners_to=self.test_partner.ids)
+ initial_channel_info = self.env['discuss.channel'].channel_get(partners_to=self.test_partner.ids)
# shape of channelMembers is [('insert', data...)], [0][1] accesses the data
self.assertEqual(set(m['persona']['partner']['id'] for m in initial_channel_info['channel']['channelMembers'][0][1]), {self.partner_employee_nomail.id, self.test_partner.id})
# `channel_get` should return the existing channel every time the same partner is given
- same_channel_info = self.env['mail.channel'].channel_get(partners_to=self.test_partner.ids)
+ same_channel_info = self.env['discuss.channel'].channel_get(partners_to=self.test_partner.ids)
self.assertEqual(same_channel_info['id'], initial_channel_info['id'])
# `channel_get` should return the existing channel when the current partner is given together with the other partner
- together_channel_info = self.env['mail.channel'].channel_get(partners_to=(self.partner_employee_nomail + self.test_partner).ids)
+ together_channel_info = self.env['discuss.channel'].channel_get(partners_to=(self.partner_employee_nomail + self.test_partner).ids)
self.assertEqual(together_channel_info['id'], initial_channel_info['id'])
# `channel_get` should return a new channel the first time just the current partner is given,
# even if a channel containing the current partner together with other partners already exists
- solo_channel_info = self.env['mail.channel'].channel_get(partners_to=self.partner_employee_nomail.ids)
+ solo_channel_info = self.env['discuss.channel'].channel_get(partners_to=self.partner_employee_nomail.ids)
self.assertNotEqual(solo_channel_info['id'], initial_channel_info['id'])
# shape of channelMembers is [('insert', data...)], [0][1] accesses the data
self.assertEqual(set(m['persona']['partner']['id'] for m in solo_channel_info['channel']['channelMembers'][0][1]), {self.partner_employee_nomail.id})
# `channel_get` should return the existing channel every time the current partner is given
- same_solo_channel_info = self.env['mail.channel'].channel_get(partners_to=self.partner_employee_nomail.ids)
+ same_solo_channel_info = self.env['discuss.channel'].channel_get(partners_to=self.partner_employee_nomail.ids)
self.assertEqual(same_solo_channel_info['id'], solo_channel_info['id'])
# `channel_get` will pin the channel by default and thus last interest will be updated.
@users('employee')
def test_channel_info_get_should_update_last_interest_dt(self):
# create the channel via `channel_get`
- self.env['mail.channel'].channel_get(partners_to=self.partner_admin.ids)
+ self.env['discuss.channel'].channel_get(partners_to=self.partner_admin.ids)
retrieve_time = datetime(2021, 1, 1, 0, 0)
with patch.object(fields.Datetime, 'now', lambda: retrieve_time):
# `last_interest_dt` should be updated again when `channel_get` is called
# because `channel_pin` is called.
- channel_info = self.env['mail.channel'].channel_get(partners_to=self.partner_admin.ids)
+ channel_info = self.env['discuss.channel'].channel_get(partners_to=self.partner_admin.ids)
self.assertEqual(channel_info['last_interest_dt'], retrieve_time.strftime(DEFAULT_SERVER_DATETIME_FORMAT))
@users('employee')
def test_channel_info_seen(self):
""" In case of concurrent channel_seen RPC, ensure the oldest call has no effect. """
- channel_info = self.env['mail.channel'].with_user(self.user_admin).channel_get((self.partner_employee | self.user_admin.partner_id).ids)
- chat = self.env['mail.channel'].with_user(self.user_admin).browse(channel_info['id'])
+ channel_info = self.env['discuss.channel'].with_user(self.user_admin).channel_get((self.partner_employee | self.user_admin.partner_id).ids)
+ chat = self.env['discuss.channel'].with_user(self.user_admin).browse(channel_info['id'])
msg_1 = self._add_messages(chat, 'Body1', author=self.user_employee.partner_id)
msg_2 = self._add_messages(chat, 'Body2', author=self.user_employee.partner_id)
@@ -396,7 +394,7 @@ class TestChannelInternals(MailCommon):
)
def test_channel_message_post_should_not_allow_adding_wrong_parent(self):
- channels = self.env['mail.channel'].create([{'name': '1'}, {'name': '2'}])
+ channels = self.env['discuss.channel'].create([{'name': '1'}, {'name': '2'}])
message = self._add_messages(channels[0], 'Body1')
message_format2 = channels[1].message_post(body='Body2', parent_id=message.id)
self.assertFalse(message_format2['parent_id'], "should not allow parent from wrong thread")
@@ -412,7 +410,7 @@ class TestChannelInternals(MailCommon):
"name": "Jonas",
})
test_partner = test_user.partner_id
- group_restricted_channel = self.env['mail.channel'].with_context(self._test_context).create({
+ group_restricted_channel = self.env['discuss.channel'].with_context(self._test_context).create({
'name': 'Sic Mundus',
'group_public_id': self.env.ref('base.group_user').id,
'channel_partner_ids': [Command.link(self.user_employee.partner_id.id), Command.link(test_partner.id)],
@@ -420,7 +418,7 @@ class TestChannelInternals(MailCommon):
self.test_channel.with_context(self._test_context).write({
'channel_partner_ids': [Command.link(self.user_employee.partner_id.id), Command.link(test_partner.id)],
})
- private_group = self.env['mail.channel'].with_user(self.user_employee).with_context(self._test_context).create({
+ private_group = self.env['discuss.channel'].with_user(self.user_employee).with_context(self._test_context).create({
'name': 'test',
'channel_type': 'group',
'channel_partner_ids': [Command.link(self.user_employee.partner_id.id), Command.link(test_partner.id)],
@@ -443,10 +441,10 @@ class TestChannelInternals(MailCommon):
@mute_logger('odoo.models.unlink')
def test_channel_private_unfollow(self):
""" Test that a partner can leave (unfollow) a channel/group/chat. """
- group_restricted_channel = self.env['mail.channel'].browse(self.env['mail.channel'].channel_create(name='Channel for Groups', group_id=self.env.ref('base.group_user').id)['id'])
- public_channel = self.env['mail.channel'].browse(self.env['mail.channel'].channel_create(name='Channel for Everyone', group_id=None)['id'])
- private_group = self.env['mail.channel'].browse(self.env['mail.channel'].create_group(partners_to=self.user_employee.partner_id.ids, name="Group")['id'])
- chat_user_current = self.env['mail.channel'].browse(self.env['mail.channel'].channel_get(self.env.user.partner_id.ids)['id'])
+ group_restricted_channel = self.env['discuss.channel'].browse(self.env['discuss.channel'].channel_create(name='Channel for Groups', group_id=self.env.ref('base.group_user').id)['id'])
+ public_channel = self.env['discuss.channel'].browse(self.env['discuss.channel'].channel_create(name='Channel for Everyone', group_id=None)['id'])
+ private_group = self.env['discuss.channel'].browse(self.env['discuss.channel'].create_group(partners_to=self.user_employee.partner_id.ids, name="Group")['id'])
+ chat_user_current = self.env['discuss.channel'].browse(self.env['discuss.channel'].channel_get(self.env.user.partner_id.ids)['id'])
group_restricted_channel.add_members(self.env.user.partner_id.id)
public_channel.add_members(self.env.user.partner_id.id)
@@ -470,12 +468,12 @@ class TestChannelInternals(MailCommon):
If the partner has been removed earlier, no more messages will be posted
even if `_action_unfollow()` is called again.
'''
- channel = self.env['mail.channel'].browse(self.test_channel.id)
+ channel = self.env['discuss.channel'].browse(self.test_channel.id)
channel.add_members(self.test_partner.ids)
# no message should be posted under test_partner's name
messages_0 = self.env['mail.message'].search([
- ('model', '=', 'mail.channel'),
+ ('model', '=', 'discuss.channel'),
('res_id', '=', channel.id),
('author_id', '=', self.test_partner.id)
])
@@ -484,7 +482,7 @@ class TestChannelInternals(MailCommon):
# a message should be posted to notify others when a partner is about to leave
channel._action_unfollow(self.test_partner)
messages_1 = self.env['mail.message'].search([
- ('model', '=', 'mail.channel'),
+ ('model', '=', 'discuss.channel'),
('res_id', '=', channel.id),
('author_id', '=', self.test_partner.id)
])
@@ -493,7 +491,7 @@ class TestChannelInternals(MailCommon):
# no more messages should be posted if the partner has been removed before.
channel._action_unfollow(self.test_partner)
messages_2 = self.env['mail.message'].search([
- ('model', '=', 'mail.channel'),
+ ('model', '=', 'discuss.channel'),
('res_id', '=', channel.id),
('author_id', '=', self.test_partner.id)
])
@@ -501,9 +499,9 @@ class TestChannelInternals(MailCommon):
self.assertEqual(messages_1, messages_2)
def test_channel_should_generate_correct_default_avatar(self):
- test_channel = self.env['mail.channel'].browse(self.env['mail.channel'].channel_create(name='Channel', group_id=self.env.ref('base.group_user').id)['id'])
+ test_channel = self.env['discuss.channel'].browse(self.env['discuss.channel'].channel_create(name='Channel', group_id=self.env.ref('base.group_user').id)['id'])
test_channel.uuid = 'channel-uuid'
- private_group = self.env['mail.channel'].browse(self.env['mail.channel'].create_group(partners_to=self.user_employee.partner_id.ids)['id'])
+ private_group = self.env['discuss.channel'].browse(self.env['discuss.channel'].create_group(partners_to=self.user_employee.partner_id.ids)['id'])
private_group.uuid = 'group-uuid'
bgcolor_channel = html_escape('hsl(316, 61%, 45%)') # depends on uuid
bgcolor_group = html_escape('hsl(17, 60%, 45%)') # depends on uuid
@@ -517,14 +515,14 @@ class TestChannelInternals(MailCommon):
self.assertEqual(test_channel.avatar_128, test_channel.image_128)
def test_channel_write_should_send_notification_if_image_128_changed(self):
- channel = self.env['mail.channel'].create({'name': '', 'uuid': 'test-uuid'})
+ channel = self.env['discuss.channel'].create({'name': '', 'uuid': 'test-uuid'})
# do the operation once before the assert to grab the value to expect
channel.image_128 = base64.b64encode(("
").encode())
avatar_cache_key = channel._get_avatar_cache_key()
channel.image_128 = False
self.env['bus.bus'].search([]).unlink()
with self.assertBus(
- [(self.cr.dbname, 'mail.channel', channel.id)],
+ [(self.cr.dbname, 'discuss.channel', channel.id)],
[{
"type": "mail.record/insert",
"payload": {
@@ -544,7 +542,7 @@ class TestChannelInternals(MailCommon):
- OR we have access to the channel
"""
self.assertEqual(self.user_employee._init_messaging()['starred_counter'], 0)
- test_group = self.env['mail.channel'].create({
+ test_group = self.env['discuss.channel'].create({
'name': 'Private Channel',
'channel_type': 'group',
'channel_partner_ids': [(6, 0, self.partner_employee.id)]
@@ -566,15 +564,15 @@ class TestChannelInternals(MailCommon):
self.assertEqual(self.env.user.company_id, self.company_admin)
with self.with_user('employee'):
- initial_channel_info = self.env['mail.channel'].with_context(
+ initial_channel_info = self.env['discuss.channel'].with_context(
allowed_company_ids=self.company_admin.ids
).channel_get(self.partner_employee_c2.ids)
self.assertTrue(initial_channel_info, 'should be able to chat with multi company user')
@users('employee')
def test_create_chat_channel_should_only_pin_the_channel_for_the_current_user(self):
- chat = self.env['mail.channel'].channel_get(partners_to=self.test_partner.ids)
- member_of_current_user = self.env['mail.channel.member'].search([('channel_id', '=', chat['id']), ('partner_id', '=', self.env.user.partner_id.id)])
- member_of_correspondent = self.env['mail.channel.member'].search([('channel_id', '=', chat['id']), ('partner_id', '=', self.test_partner.id)])
+ chat = self.env['discuss.channel'].channel_get(partners_to=self.test_partner.ids)
+ member_of_current_user = self.env['discuss.channel.member'].search([('channel_id', '=', chat['id']), ('partner_id', '=', self.env.user.partner_id.id)])
+ member_of_correspondent = self.env['discuss.channel.member'].search([('channel_id', '=', chat['id']), ('partner_id', '=', self.test_partner.id)])
self.assertTrue(member_of_current_user.is_pinned)
self.assertFalse(member_of_correspondent.is_pinned)
diff --git a/addons/mail/tests/test_mail_channel_as_guest.py b/addons/mail/tests/test_discuss_channel_as_guest.py
similarity index 82%
rename from addons/mail/tests/test_mail_channel_as_guest.py
rename to addons/mail/tests/test_discuss_channel_as_guest.py
index bb4e3ccd077..aec600d384d 100644
--- a/addons/mail/tests/test_mail_channel_as_guest.py
+++ b/addons/mail/tests/test_discuss_channel_as_guest.py
@@ -28,12 +28,12 @@ class TestMailPublicPage(HttpCase):
)
guest = self.env['mail.guest'].create({'name': 'Guest Mario'})
- self.channel = self.env['mail.channel'].browse(self.env['mail.channel'].channel_create(group_id=None, name='Test channel')['id'])
+ self.channel = self.env['discuss.channel'].browse(self.env['discuss.channel'].channel_create(group_id=None, name='Test channel')['id'])
self.channel.add_members(portal_user.partner_id.ids)
self.channel.add_members(internal_user.partner_id.ids)
self.channel.add_members(guest_ids=[guest.id])
- self.group = self.env['mail.channel'].browse(self.env['mail.channel'].create_group(partners_to=(internal_user + portal_user).partner_id.ids, name="Test group")['id'])
+ self.group = self.env['discuss.channel'].browse(self.env['discuss.channel'].create_group(partners_to=(internal_user + portal_user).partner_id.ids, name="Test group")['id'])
self.group.add_members(guest_ids=[guest.id])
self.tour = "mail/static/tests/tours/discuss_public_tour.js"
@@ -50,29 +50,29 @@ class TestMailPublicPage(HttpCase):
# the channel, so we need to run it again to test different parts of the code.
self.start_tour(self.group.invitation_url, self.tour, login=login)
- def test_mail_channel_public_page_as_admin(self):
+ def test_discuss_channel_public_page_as_admin(self):
self._open_channel_page_as_user('admin')
def test_mail_group_public_page_as_admin(self):
self._open_group_page_as_user('admin')
- def test_mail_channel_public_page_as_guest(self):
- self.start_tour(self.channel.invitation_url, "mail/static/tests/tours/mail_channel_as_guest_tour.js")
+ def test_discuss_channel_public_page_as_guest(self):
+ self.start_tour(self.channel.invitation_url, "mail/static/tests/tours/discuss_channel_as_guest_tour.js")
guest = self.env['mail.guest'].search([('channel_ids', 'in', self.channel.id)], limit=1, order='id desc')
self.start_tour(self.channel.invitation_url, self.tour, cookies={guest._cookie_name: f"{guest.id}{guest._cookie_separator}{guest.access_token}"})
def test_mail_group_public_page_as_guest(self):
- self.start_tour(self.group.invitation_url, "mail/static/tests/tours/mail_channel_as_guest_tour.js")
+ self.start_tour(self.group.invitation_url, "mail/static/tests/tours/discuss_channel_as_guest_tour.js")
guest = self.env['mail.guest'].search([('channel_ids', 'in', self.channel.id)], limit=1, order='id desc')
self.start_tour(self.group.invitation_url, self.tour, cookies={guest._cookie_name: f"{guest.id}{guest._cookie_separator}{guest.access_token}"})
- def test_mail_channel_public_page_as_internal(self):
+ def test_discuss_channel_public_page_as_internal(self):
self._open_channel_page_as_user('demo')
def test_mail_group_public_page_as_internal(self):
self._open_group_page_as_user('demo')
- def test_mail_channel_public_page_as_portal(self):
+ def test_discuss_channel_public_page_as_portal(self):
self._open_channel_page_as_user('portal')
def test_mail_group_public_page_as_portal(self):
@@ -81,5 +81,5 @@ class TestMailPublicPage(HttpCase):
def test_chat_from_token_as_guest(self):
self.env['ir.config_parameter'].set_param('mail.chat_from_token', True)
self.url_open('/chat/xyz')
- channel = self.env['mail.channel'].search([('uuid', '=', 'xyz')])
+ channel = self.env['discuss.channel'].search([('uuid', '=', 'xyz')])
self.assertEqual(len(channel), 1)
diff --git a/addons/mail/tests/test_mail_channel_member.py b/addons/mail/tests/test_discuss_channel_member.py
similarity index 70%
rename from addons/mail/tests/test_mail_channel_member.py
rename to addons/mail/tests/test_discuss_channel_member.py
index 017a57451fd..95324c215d6 100644
--- a/addons/mail/tests/test_mail_channel_member.py
+++ b/addons/mail/tests/test_discuss_channel_member.py
@@ -7,14 +7,14 @@ from odoo.addons.mail.tests.common import mail_new_test_user
from odoo.addons.mail.tests.common import MailCommon
from odoo.exceptions import AccessError, UserError
-mail_channel_new_test_user = partial(mail_new_test_user, context={'mail_channel_nosubscribe': False})
+discuss_channel_new_test_user = partial(mail_new_test_user, context={'discuss_channel_nosubscribe': False})
-class TestMailChannelMembers(MailCommon):
+class TestDiscussChannelMembers(MailCommon):
@classmethod
def setUpClass(cls):
- super(TestMailChannelMembers, cls).setUpClass()
+ super(TestDiscussChannelMembers, cls).setUpClass()
cls.secret_group = cls.env['res.groups'].create({
'name': 'Secret User Group',
@@ -26,37 +26,37 @@ class TestMailChannelMembers(MailCommon):
'res_id': cls.secret_group.id,
})
- cls.user_1 = mail_channel_new_test_user(
+ cls.user_1 = discuss_channel_new_test_user(
cls.env, login='user_1',
name='User 1',
groups='base.group_user,mail.secret_group')
- cls.user_2 = mail_channel_new_test_user(
+ cls.user_2 = discuss_channel_new_test_user(
cls.env, login='user_2',
name='User 2',
groups='base.group_user,mail.secret_group')
- cls.user_3 = mail_channel_new_test_user(
+ cls.user_3 = discuss_channel_new_test_user(
cls.env, login='user_3',
name='User 3',
groups='base.group_user,mail.secret_group')
- cls.user_portal = mail_channel_new_test_user(
+ cls.user_portal = discuss_channel_new_test_user(
cls.env, login='user_portal',
name='User Portal',
groups='base.group_portal')
- cls.user_public = mail_channel_new_test_user(
+ cls.user_public = discuss_channel_new_test_user(
cls.env, login='user_ublic',
name='User Public',
groups='base.group_public')
- cls.group = cls.env['mail.channel'].create({
+ cls.group = cls.env['discuss.channel'].create({
'name': 'Group',
'channel_type': 'group',
})
- cls.group_restricted_channel = cls.env['mail.channel'].create({
+ cls.group_restricted_channel = cls.env['discuss.channel'].create({
'name': 'Group restricted channel',
'channel_type': 'channel',
'group_public_id': cls.secret_group.id,
})
- cls.public_channel = cls.env['mail.channel'].browse(cls.env['mail.channel'].channel_create(group_id=None, name='Public channel of user 1')['id'])
+ cls.public_channel = cls.env['discuss.channel'].browse(cls.env['discuss.channel'].channel_create(group_id=None, name='Public channel of user 1')['id'])
(cls.group | cls.group_restricted_channel | cls.public_channel).channel_member_ids.unlink()
# ------------------------------------------------------------
@@ -65,27 +65,27 @@ class TestMailChannelMembers(MailCommon):
def test_group_01(self):
"""Test access on group."""
- res = self.env['mail.channel.member'].search([('channel_id', '=', self.group.id)])
+ res = self.env['discuss.channel.member'].search([('channel_id', '=', self.group.id)])
self.assertFalse(res)
# User 1 can join group with SUDO
self.group.with_user(self.user_1).sudo().add_members(self.user_1.partner_id.ids)
- res = self.env['mail.channel.member'].search([('channel_id', '=', self.group.id)])
+ res = self.env['discuss.channel.member'].search([('channel_id', '=', self.group.id)])
self.assertEqual(res.partner_id, self.user_1.partner_id)
# User 2 can not join group
with self.assertRaises(AccessError):
self.group.with_user(self.user_2).add_members(self.user_2.partner_id.ids)
- # User 2 can not create a `mail.channel.member` to join the group
+ # User 2 can not create a `discuss.channel.member` to join the group
with self.assertRaises(AccessError):
- self.env['mail.channel.member'].with_user(self.user_2).create({
+ self.env['discuss.channel.member'].with_user(self.user_2).create({
'partner_id': self.user_2.partner_id.id,
'channel_id': self.group.id,
})
- # User 2 can not write on `mail.channel.member` to join the group
- channel_member = self.env['mail.channel.member'].with_user(self.user_2).search([('partner_id', '=', self.user_2.partner_id.id)])[0]
+ # User 2 can not write on `discuss.channel.member` to join the group
+ channel_member = self.env['discuss.channel.member'].with_user(self.user_2).search([('partner_id', '=', self.user_2.partner_id.id)])[0]
with self.assertRaises(AccessError):
channel_member.channel_id = self.group.id
with self.assertRaises(AccessError):
@@ -95,9 +95,9 @@ class TestMailChannelMembers(MailCommon):
with self.assertRaises(AccessError):
channel_member.sudo().channel_id = self.group.id
- # User 2 can not write on the `partner_id` of `mail.channel.member`
+ # User 2 can not write on the `partner_id` of `discuss.channel.member`
# of an other partner to join a group
- channel_member_1 = self.env['mail.channel.member'].search([('channel_id', '=', self.group.id), ('partner_id', '=', self.user_1.partner_id.id)])
+ channel_member_1 = self.env['discuss.channel.member'].search([('channel_id', '=', self.group.id), ('partner_id', '=', self.user_1.partner_id.id)])
with self.assertRaises(AccessError):
channel_member_1.with_user(self.user_2).partner_id = self.user_2.partner_id
self.assertEqual(channel_member_1.partner_id, self.user_1.partner_id)
@@ -109,27 +109,27 @@ class TestMailChannelMembers(MailCommon):
def test_group_members(self):
"""Test invitation in group part 1 (invite using crud methods)."""
self.group.with_user(self.user_1).sudo().add_members(self.user_1.partner_id.ids)
- channel_members = self.env['mail.channel.member'].search([('channel_id', '=', self.group.id)])
+ channel_members = self.env['discuss.channel.member'].search([('channel_id', '=', self.group.id)])
self.assertEqual(len(channel_members), 1)
# User 2 is not in the group, they can not invite user 3
with self.assertRaises(AccessError):
- self.env['mail.channel.member'].with_user(self.user_2).create({
+ self.env['discuss.channel.member'].with_user(self.user_2).create({
'partner_id': self.user_portal.partner_id.id,
'channel_id': self.group.id,
})
# User 1 is in the group, they can invite other users
- self.env['mail.channel.member'].with_user(self.user_1).create({
+ self.env['discuss.channel.member'].with_user(self.user_1).create({
'partner_id': self.user_portal.partner_id.id,
'channel_id': self.group.id,
})
- channel_members = self.env['mail.channel.member'].search([('channel_id', '=', self.group.id)])
+ channel_members = self.env['discuss.channel.member'].search([('channel_id', '=', self.group.id)])
self.assertEqual(channel_members.mapped('partner_id'), self.user_1.partner_id | self.user_portal.partner_id)
- # But User 3 can not write on the `mail.channel.member` of other user
- channel_member_1 = self.env['mail.channel.member'].search([('channel_id', '=', self.group.id), ('partner_id', '=', self.user_1.partner_id.id)])
- channel_member_3 = self.env['mail.channel.member'].search([('channel_id', '=', self.group.id), ('partner_id', '=', self.user_portal.partner_id.id)])
+ # But User 3 can not write on the `discuss.channel.member` of other user
+ channel_member_1 = self.env['discuss.channel.member'].search([('channel_id', '=', self.group.id), ('partner_id', '=', self.user_1.partner_id.id)])
+ channel_member_3 = self.env['discuss.channel.member'].search([('channel_id', '=', self.group.id), ('partner_id', '=', self.user_portal.partner_id.id)])
channel_member_3.with_user(self.user_portal).custom_channel_name = 'Test'
with self.assertRaises(AccessError):
channel_member_1.with_user(self.user_2).custom_channel_name = 'Blabla'
@@ -138,25 +138,25 @@ class TestMailChannelMembers(MailCommon):
def test_group_invite(self):
"""Test invitation in group part 2 (use `invite` action)."""
self.group.with_user(self.user_1).sudo().add_members(self.user_1.partner_id.ids)
- channel_members = self.env['mail.channel.member'].search([('channel_id', '=', self.group.id)])
+ channel_members = self.env['discuss.channel.member'].search([('channel_id', '=', self.group.id)])
self.assertEqual(channel_members.mapped('partner_id'), self.user_1.partner_id)
# User 2 is not in the group, they can not invite user_portal
with self.assertRaises(AccessError):
self.group.with_user(self.user_2).add_members(self.user_portal.partner_id.ids)
- channel_members = self.env['mail.channel.member'].search([('channel_id', '=', self.group.id)])
+ channel_members = self.env['discuss.channel.member'].search([('channel_id', '=', self.group.id)])
self.assertEqual(channel_members.mapped('partner_id'), self.user_1.partner_id)
# User 1 is in the group, they can invite user_portal
self.group.with_user(self.user_1).add_members(self.user_portal.partner_id.ids)
- channel_members = self.env['mail.channel.member'].search([('channel_id', '=', self.group.id)])
+ channel_members = self.env['discuss.channel.member'].search([('channel_id', '=', self.group.id)])
self.assertEqual(channel_members.mapped('partner_id'), self.user_1.partner_id | self.user_portal.partner_id)
def test_group_leave(self):
"""Test kick/leave channel."""
self.group.with_user(self.user_1).sudo().add_members(self.user_1.partner_id.ids)
self.group.with_user(self.user_portal).sudo().add_members(self.user_portal.partner_id.ids)
- channel_members = self.env['mail.channel.member'].search([('channel_id', '=', self.group.id)])
+ channel_members = self.env['discuss.channel.member'].search([('channel_id', '=', self.group.id)])
self.assertEqual(len(channel_members), 2)
# User 2 is not in the group, they can not kick user 1
@@ -172,34 +172,34 @@ class TestMailChannelMembers(MailCommon):
def test_group_restricted_channel(self):
"""Test basics on group channel."""
- channel_members = self.env['mail.channel.member'].search([('channel_id', '=', self.group_restricted_channel.id)])
+ channel_members = self.env['discuss.channel.member'].search([('channel_id', '=', self.group_restricted_channel.id)])
self.assertFalse(channel_members)
# user 1 is in the channel, they can join the channel
self.group_restricted_channel.with_user(self.user_1).add_members(self.user_1.partner_id.ids)
- channel_members = self.env['mail.channel.member'].search([('channel_id', '=', self.group_restricted_channel.id)])
+ channel_members = self.env['discuss.channel.member'].search([('channel_id', '=', self.group_restricted_channel.id)])
self.assertEqual(channel_members.mapped('partner_id'), self.user_1.partner_id)
# user 3 is not in the channel, they can not join
with self.assertRaises(AccessError):
self.group_restricted_channel.with_user(self.user_portal).add_members(self.user_portal.partner_id.ids)
- channel_members = self.env['mail.channel.member'].search([('channel_id', '=', self.group_restricted_channel.id)])
+ channel_members = self.env['discuss.channel.member'].search([('channel_id', '=', self.group_restricted_channel.id)])
with self.assertRaises(AccessError):
channel_members.with_user(self.user_portal).partner_id = self.user_portal.partner_id
- channel_members = self.env['mail.channel.member'].search([('channel_id', '=', self.group_restricted_channel.id)])
+ channel_members = self.env['discuss.channel.member'].search([('channel_id', '=', self.group_restricted_channel.id)])
self.assertEqual(channel_members.mapped('partner_id'), self.user_1.partner_id)
# user 1 can not invite user 3 because they are not in the channel
with self.assertRaises(UserError):
self.group_restricted_channel.with_user(self.user_1).add_members(self.user_portal.partner_id.ids)
- channel_members = self.env['mail.channel.member'].search([('channel_id', '=', self.group_restricted_channel.id)])
+ channel_members = self.env['discuss.channel.member'].search([('channel_id', '=', self.group_restricted_channel.id)])
self.assertEqual(channel_members.mapped('partner_id'), self.user_1.partner_id)
# but user 2 is in the channel and can be invited by user 1
self.group_restricted_channel.with_user(self.user_1).add_members(self.user_2.partner_id.ids)
- channel_members = self.env['mail.channel.member'].search([('channel_id', '=', self.group_restricted_channel.id)])
+ channel_members = self.env['discuss.channel.member'].search([('channel_id', '=', self.group_restricted_channel.id)])
self.assertEqual(channel_members.mapped('partner_id'), self.user_1.partner_id | self.user_2.partner_id)
# ------------------------------------------------------------
@@ -208,15 +208,15 @@ class TestMailChannelMembers(MailCommon):
def test_public_channel(self):
""" Test access on public channels """
- channel_members = self.env['mail.channel.member'].search([('channel_id', '=', self.public_channel.id)])
+ channel_members = self.env['discuss.channel.member'].search([('channel_id', '=', self.public_channel.id)])
self.assertFalse(channel_members)
self.public_channel.with_user(self.user_1).add_members(self.user_1.partner_id.ids)
- channel_members = self.env['mail.channel.member'].search([('channel_id', '=', self.public_channel.id)])
+ channel_members = self.env['discuss.channel.member'].search([('channel_id', '=', self.public_channel.id)])
self.assertEqual(channel_members.mapped('partner_id'), self.user_1.partner_id)
self.public_channel.with_user(self.user_2).add_members(self.user_2.partner_id.ids)
- channel_members = self.env['mail.channel.member'].search([('channel_id', '=', self.public_channel.id)])
+ channel_members = self.env['discuss.channel.member'].search([('channel_id', '=', self.public_channel.id)])
self.assertEqual(channel_members.mapped('partner_id'), self.user_1.partner_id | self.user_2.partner_id)
# portal/public users still cannot join a public channel, should go through dedicated controllers
@@ -243,32 +243,32 @@ class TestMailChannelMembers(MailCommon):
# ------------------------------------------------------------
def test_unread_counter_with_message_post(self):
- channel_as_user_1 = self.env['mail.channel'].browse(self.env['mail.channel'].with_user(self.user_1).channel_create(group_id=None, name='Public channel')['id'])
+ channel_as_user_1 = self.env['discuss.channel'].browse(self.env['discuss.channel'].with_user(self.user_1).channel_create(group_id=None, name='Public channel')['id'])
channel_as_user_1.with_user(self.user_1).add_members(self.user_1.partner_id.ids)
channel_as_user_1.with_user(self.user_1).add_members(self.user_2.partner_id.ids)
- channel_1_rel_user_2 = self.env['mail.channel.member'].search([
+ channel_1_rel_user_2 = self.env['discuss.channel.member'].search([
('channel_id', '=', channel_as_user_1.id),
('partner_id', '=', self.user_2.partner_id.id)
])
self.assertEqual(channel_1_rel_user_2.message_unread_counter, 0, "should not have unread message initially as notification type is ignored")
channel_as_user_1.message_post(body='Test', message_type='comment', subtype_xmlid='mail.mt_comment')
- channel_1_rel_user_2 = self.env['mail.channel.member'].search([
+ channel_1_rel_user_2 = self.env['discuss.channel.member'].search([
('channel_id', '=', channel_as_user_1.id),
('partner_id', '=', self.user_2.partner_id.id)
])
self.assertEqual(channel_1_rel_user_2.message_unread_counter, 1, "should have 1 unread message after someone else posted a message")
def test_unread_counter_with_message_post_multi_channel(self):
- channel_1_as_user_1 = self.env['mail.channel'].with_user(self.user_1).browse(self.env['mail.channel'].with_user(self.user_1).channel_create(group_id=None, name='wololo channel')['id'])
- channel_2_as_user_2 = self.env['mail.channel'].with_user(self.user_2).browse(self.env['mail.channel'].with_user(self.user_2).channel_create(group_id=None, name='walala channel')['id'])
+ channel_1_as_user_1 = self.env['discuss.channel'].with_user(self.user_1).browse(self.env['discuss.channel'].with_user(self.user_1).channel_create(group_id=None, name='wololo channel')['id'])
+ channel_2_as_user_2 = self.env['discuss.channel'].with_user(self.user_2).browse(self.env['discuss.channel'].with_user(self.user_2).channel_create(group_id=None, name='walala channel')['id'])
channel_1_as_user_1.add_members(self.user_2.partner_id.ids)
channel_2_as_user_2.add_members(self.user_1.partner_id.ids)
channel_2_as_user_2.add_members(self.user_3.partner_id.ids)
channel_1_as_user_1.message_post(body='Test', message_type='comment', subtype_xmlid='mail.mt_comment')
channel_1_as_user_1.message_post(body='Test 2', message_type='comment', subtype_xmlid='mail.mt_comment')
channel_2_as_user_2.message_post(body='Test', message_type='comment', subtype_xmlid='mail.mt_comment')
- members = self.env['mail.channel.member'].search([('channel_id', 'in', (channel_1_as_user_1 + channel_2_as_user_2).ids)], order="id")
+ members = self.env['discuss.channel.member'].search([('channel_id', 'in', (channel_1_as_user_1 + channel_2_as_user_2).ids)], order="id")
self.assertEqual(members.mapped('message_unread_counter'), [
0, # channel 1 user 1: posted last message
0, # channel 2 user 2: posted last message
diff --git a/addons/mail/tests/test_link_preview.py b/addons/mail/tests/test_link_preview.py
index 00f73da973b..2169d00722d 100644
--- a/addons/mail/tests/test_link_preview.py
+++ b/addons/mail/tests/test_link_preview.py
@@ -7,7 +7,7 @@ from odoo.addons.mail.tests.common import MailCommon
from unittest.mock import patch
import requests
-mail_channel_new_test_user = partial(mail_new_test_user, context={'mail_channel_nosubscribe': False})
+discuss_channel_new_test_user = partial(mail_new_test_user, context={'discuss_channel_nosubscribe': False})
def _patched_get_html(*args, **kwargs):
@@ -36,12 +36,12 @@ class TestLinkPreview(MailCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
- cls.user_1 = mail_channel_new_test_user(
+ cls.user_1 = discuss_channel_new_test_user(
cls.env, login='user_1',
name='User 1',
groups='base.group_user')
- cls.public_channel = cls.env['mail.channel'].create({
+ cls.public_channel = cls.env['discuss.channel'].create({
'name': 'Public channel of user 1',
'channel_type': 'channel',
})
@@ -55,7 +55,7 @@ class TestLinkPreview(MailCommon):
link_previews.append({'source_url': 'https://thisdomainedoentexist.nothing', 'message_id': 1})
self.env['mail.link.preview'].create(link_previews)
message = self.env['mail.message'].create({
- 'model': 'mail.channel',
+ 'model': 'discuss.channel',
'res_id': self.public_channel.id,
'body': '
Nothing link',
})
@@ -66,13 +66,13 @@ class TestLinkPreview(MailCommon):
def test_02_link_preview_create(self):
with patch.object(requests.Session, 'get', _patched_get_html), patch.object(requests.Session, 'head', _patch_head_html):
message = self.env['mail.message'].create({
- 'model': 'mail.channel',
+ 'model': 'discuss.channel',
'res_id': self.public_channel.id,
'body': '
Nothing link',
})
self.env['mail.link.preview']._create_link_previews(message)
self.assertBusNotifications(
- [(self.cr.dbname, 'mail.channel', self.public_channel.id)],
+ [(self.cr.dbname, 'discuss.channel', self.public_channel.id)],
message_items=[{
'type': 'mail.record/insert',
'payload': {
diff --git a/addons/mail/tests/test_rtc.py b/addons/mail/tests/test_rtc.py
index 8b222039c62..a51b3e46961 100644
--- a/addons/mail/tests/test_rtc.py
+++ b/addons/mail/tests/test_rtc.py
@@ -17,32 +17,32 @@ class TestChannelInternals(MailCommon):
@mute_logger('odoo.models.unlink')
def test_01_join_call(self):
"""Join call should remove existing sessions, remove invitation, create a new session, and return data."""
- channel = self.env['mail.channel'].browse(self.env['mail.channel'].channel_create(name='Test Channel', group_id=self.env.ref('base.group_user').id)['id'])
+ channel = self.env['discuss.channel'].browse(self.env['discuss.channel'].channel_create(name='Test Channel', group_id=self.env.ref('base.group_user').id)['id'])
channel_member = channel.sudo().channel_member_ids.filtered(lambda channel_member: channel_member.partner_id == self.user_employee.partner_id)
channel_member._rtc_join_call()
self.env['bus.bus'].sudo().search([]).unlink()
with self.assertBus(
[
(self.cr.dbname, 'res.partner', self.user_employee.partner_id.id), # end of previous session
- (self.cr.dbname, 'mail.channel', channel.id), # update sessions
- (self.cr.dbname, 'mail.channel', channel.id), # update sessions
+ (self.cr.dbname, 'discuss.channel', channel.id), # update sessions
+ (self.cr.dbname, 'discuss.channel', channel.id), # update sessions
],
[
{
- 'type': 'mail.channel.rtc.session/ended',
+ 'type': 'discuss.channel.rtc.session/ended',
'payload': {
'sessionId': channel_member.rtc_session_ids.id,
},
},
{
- 'type': 'mail.channel/rtc_sessions_update',
+ 'type': 'discuss.channel/rtc_sessions_update',
'payload': {
'id': channel.id,
'rtcSessions': [('insert-and-unlink', [{'id': channel_member.rtc_session_ids.id}])],
},
},
{
- 'type': 'mail.channel/rtc_sessions_update',
+ 'type': 'discuss.channel/rtc_sessions_update',
'payload': {
'id': channel.id,
'rtcSessions': [('insert', [{
@@ -98,7 +98,7 @@ class TestChannelInternals(MailCommon):
@mute_logger('odoo.models.unlink')
def test_10_start_call_in_chat_should_invite_all_members_to_call(self):
test_user = self.env['res.users'].sudo().create({'name': "Test User", 'login': 'test'})
- channel = self.env['mail.channel'].browse(self.env['mail.channel'].channel_get(partners_to=(self.user_employee.partner_id + test_user.partner_id).ids)['id'])
+ channel = self.env['discuss.channel'].browse(self.env['discuss.channel'].channel_get(partners_to=(self.user_employee.partner_id + test_user.partner_id).ids)['id'])
channel_member = channel.sudo().channel_member_ids.filtered(lambda channel_member: channel_member.partner_id == self.user_employee.partner_id)
channel_member_test_user = channel.sudo().channel_member_ids.filtered(lambda channel_member: channel_member.partner_id == test_user.partner_id)
channel_member._rtc_join_call()
@@ -108,16 +108,16 @@ class TestChannelInternals(MailCommon):
self.env['bus.bus'].sudo().search([]).unlink()
with self.assertBus(
[
- (self.cr.dbname, 'mail.channel', channel.id), # update new session
- (self.cr.dbname, 'mail.channel', channel.id), # message_post "started a live conference" (not asserted below)
+ (self.cr.dbname, 'discuss.channel', channel.id), # update new session
+ (self.cr.dbname, 'discuss.channel', channel.id), # message_post "started a live conference" (not asserted below)
(self.cr.dbname, 'res.partner', self.user_employee.partner_id.id), # update of last interest (not asserted below)
(self.cr.dbname, 'res.partner', test_user.partner_id.id), # update of last interest (not asserted below)
(self.cr.dbname, 'res.partner', test_user.partner_id.id), # incoming invitation
- (self.cr.dbname, 'mail.channel', channel.id), # update list of invitations
+ (self.cr.dbname, 'discuss.channel', channel.id), # update list of invitations
],
[
{
- 'type': 'mail.channel/rtc_sessions_update',
+ 'type': 'discuss.channel/rtc_sessions_update',
'payload': {
'id': channel.id,
'rtcSessions': [('insert', [{
@@ -145,7 +145,7 @@ class TestChannelInternals(MailCommon):
'payload': {
'Thread': {
'id': channel.id,
- 'model': 'mail.channel',
+ 'model': 'discuss.channel',
'invitedMembers': [('insert', [{
'id': channel_member_test_user.id,
'channel': {'id': channel_member_test_user.channel_id.id},
@@ -181,7 +181,7 @@ class TestChannelInternals(MailCommon):
def test_11_start_call_in_group_should_invite_all_members_to_call(self):
test_user = self.env['res.users'].sudo().create({'name': "Test User", 'login': 'test'})
test_guest = self.env['mail.guest'].sudo().create({'name': "Test Guest"})
- channel = self.env['mail.channel'].browse(self.env['mail.channel'].create_group(partners_to=(self.user_employee.partner_id + test_user.partner_id).ids)['id'])
+ channel = self.env['discuss.channel'].browse(self.env['discuss.channel'].create_group(partners_to=(self.user_employee.partner_id + test_user.partner_id).ids)['id'])
channel.add_members(guest_ids=test_guest.ids)
channel_member_test_user = channel.sudo().channel_member_ids.filtered(lambda channel_member: channel_member.partner_id == test_user.partner_id)
channel_member_test_guest = channel.sudo().channel_member_ids.filtered(lambda channel_member: channel_member.guest_id == test_guest)
@@ -193,17 +193,17 @@ class TestChannelInternals(MailCommon):
self.env['bus.bus'].sudo().search([]).unlink()
with self.assertBus(
[
- (self.cr.dbname, 'mail.channel', channel.id), # update new session
- (self.cr.dbname, 'mail.channel', channel.id), # message_post "started a live conference" (not asserted below)
+ (self.cr.dbname, 'discuss.channel', channel.id), # update new session
+ (self.cr.dbname, 'discuss.channel', channel.id), # message_post "started a live conference" (not asserted below)
(self.cr.dbname, 'res.partner', self.user_employee.partner_id.id), # update of last interest (not asserted below)
(self.cr.dbname, 'res.partner', test_user.partner_id.id), # update of last interest (not asserted below)
(self.cr.dbname, 'res.partner', test_user.partner_id.id), # incoming invitation
(self.cr.dbname, 'mail.guest', test_guest.id), # incoming invitation
- (self.cr.dbname, 'mail.channel', channel.id), # update list of invitations
+ (self.cr.dbname, 'discuss.channel', channel.id), # update list of invitations
],
[
{
- 'type': 'mail.channel/rtc_sessions_update',
+ 'type': 'discuss.channel/rtc_sessions_update',
'payload': {
'id': channel.id,
'rtcSessions': [('insert', [{
@@ -227,7 +227,7 @@ class TestChannelInternals(MailCommon):
},
},
{
- 'type': 'mail.channel/rtc_sessions_update',
+ 'type': 'discuss.channel/rtc_sessions_update',
'payload': {
'id': channel.id,
'rtcSessions': [('insert', [{
@@ -255,7 +255,7 @@ class TestChannelInternals(MailCommon):
'payload': {
'Thread': {
'id': channel.id,
- 'model': 'mail.channel',
+ 'model': 'discuss.channel',
'invitedMembers': [('insert', [
{
'id': channel_member_test_user.id,
@@ -317,7 +317,7 @@ class TestChannelInternals(MailCommon):
def test_20_join_call_should_cancel_pending_invitations(self):
test_user = self.env['res.users'].sudo().create({'name': "Test User", 'login': 'test'})
test_guest = self.env['mail.guest'].sudo().create({'name': "Test Guest"})
- channel = self.env['mail.channel'].browse(self.env['mail.channel'].create_group(partners_to=(self.user_employee.partner_id + test_user.partner_id).ids)['id'])
+ channel = self.env['discuss.channel'].browse(self.env['discuss.channel'].create_group(partners_to=(self.user_employee.partner_id + test_user.partner_id).ids)['id'])
channel.add_members(guest_ids=test_guest.ids)
channel_member = channel.sudo().channel_member_ids.filtered(lambda channel_member: channel_member.partner_id == self.user_employee.partner_id)
channel_member._rtc_join_call()
@@ -327,8 +327,8 @@ class TestChannelInternals(MailCommon):
with self.assertBus(
[
(self.cr.dbname, 'res.partner', test_user.partner_id.id), # update invitation
- (self.cr.dbname, 'mail.channel', channel.id), # update list of invitations
- (self.cr.dbname, 'mail.channel', channel.id), # update sessions
+ (self.cr.dbname, 'discuss.channel', channel.id), # update list of invitations
+ (self.cr.dbname, 'discuss.channel', channel.id), # update sessions
],
[
{
@@ -336,7 +336,7 @@ class TestChannelInternals(MailCommon):
'payload': {
'Thread': {
'id': channel.id,
- 'model': 'mail.channel',
+ 'model': 'discuss.channel',
'rtcInvitingSession': [('unlink',)],
}
},
@@ -346,7 +346,7 @@ class TestChannelInternals(MailCommon):
'payload': {
'Thread': {
'id': channel.id,
- 'model': 'mail.channel',
+ 'model': 'discuss.channel',
'invitedMembers': [('insert-and-unlink', [{
'id': channel_member_test_user.id,
'channel': {'id': channel_member_test_user.channel_id.id},
@@ -362,7 +362,7 @@ class TestChannelInternals(MailCommon):
},
},
{
- 'type': 'mail.channel/rtc_sessions_update',
+ 'type': 'discuss.channel/rtc_sessions_update',
'payload': {
'id': channel.id,
'rtcSessions': [('insert', [
@@ -396,8 +396,8 @@ class TestChannelInternals(MailCommon):
with self.assertBus(
[
(self.cr.dbname, 'mail.guest', test_guest.id), # update invitation
- (self.cr.dbname, 'mail.channel', channel.id), # update list of invitations
- (self.cr.dbname, 'mail.channel', channel.id), # update sessions
+ (self.cr.dbname, 'discuss.channel', channel.id), # update list of invitations
+ (self.cr.dbname, 'discuss.channel', channel.id), # update sessions
],
[
{
@@ -405,7 +405,7 @@ class TestChannelInternals(MailCommon):
'payload': {
'Thread': {
'id': channel.id,
- 'model': 'mail.channel',
+ 'model': 'discuss.channel',
'rtcInvitingSession': [('unlink',)],
}
},
@@ -415,7 +415,7 @@ class TestChannelInternals(MailCommon):
'payload': {
'Thread': {
'id': channel.id,
- 'model': 'mail.channel',
+ 'model': 'discuss.channel',
'invitedMembers': [('insert-and-unlink', [{
'id': channel_member_test_guest.id,
'channel': {'id': channel_member_test_guest.channel_id.id},
@@ -431,7 +431,7 @@ class TestChannelInternals(MailCommon):
},
},
{
- 'type': 'mail.channel/rtc_sessions_update',
+ 'type': 'discuss.channel/rtc_sessions_update',
'payload': {
'id': channel.id,
'rtcSessions': [('insert', [
@@ -465,7 +465,7 @@ class TestChannelInternals(MailCommon):
def test_21_leave_call_should_cancel_pending_invitations(self):
test_user = self.env['res.users'].sudo().create({'name': "Test User", 'login': 'test'})
test_guest = self.env['mail.guest'].sudo().create({'name': "Test Guest"})
- channel = self.env['mail.channel'].browse(self.env['mail.channel'].create_group(partners_to=(self.user_employee.partner_id + test_user.partner_id).ids)['id'])
+ channel = self.env['discuss.channel'].browse(self.env['discuss.channel'].create_group(partners_to=(self.user_employee.partner_id + test_user.partner_id).ids)['id'])
channel.add_members(guest_ids=test_guest.ids)
channel_member = channel.sudo().channel_member_ids.filtered(lambda channel_member: channel_member.partner_id == self.user_employee.partner_id)
channel_member._rtc_join_call()
@@ -475,7 +475,7 @@ class TestChannelInternals(MailCommon):
with self.assertBus(
[
(self.cr.dbname, 'res.partner', test_user.partner_id.id), # update invitation
- (self.cr.dbname, 'mail.channel', channel.id), # update list of invitations
+ (self.cr.dbname, 'discuss.channel', channel.id), # update list of invitations
],
[
{
@@ -483,7 +483,7 @@ class TestChannelInternals(MailCommon):
'payload': {
'Thread': {
'id': channel.id,
- 'model': 'mail.channel',
+ 'model': 'discuss.channel',
'rtcInvitingSession': [('unlink',)],
}
},
@@ -493,7 +493,7 @@ class TestChannelInternals(MailCommon):
'payload': {
'Thread': {
'id': channel.id,
- 'model': 'mail.channel',
+ 'model': 'discuss.channel',
'invitedMembers': [('insert-and-unlink', [{
'id': channel_member_test_user.id,
'channel': {'id': channel_member_test_user.channel_id.id},
@@ -517,7 +517,7 @@ class TestChannelInternals(MailCommon):
with self.assertBus(
[
(self.cr.dbname, 'mail.guest', test_guest.id), # update invitation
- (self.cr.dbname, 'mail.channel', channel.id), # update list of invitations
+ (self.cr.dbname, 'discuss.channel', channel.id), # update list of invitations
],
[
{
@@ -525,7 +525,7 @@ class TestChannelInternals(MailCommon):
'payload': {
'Thread': {
'id': channel.id,
- 'model': 'mail.channel',
+ 'model': 'discuss.channel',
'rtcInvitingSession': [('unlink',)],
}
},
@@ -535,7 +535,7 @@ class TestChannelInternals(MailCommon):
'payload': {
'Thread': {
'id': channel.id,
- 'model': 'mail.channel',
+ 'model': 'discuss.channel',
'invitedMembers': [('insert-and-unlink', [{
'id': channel_member_test_guest.id,
'channel': {'id': channel_member_test_guest.channel_id.id},
@@ -559,7 +559,7 @@ class TestChannelInternals(MailCommon):
def test_25_lone_call_participant_leaving_call_should_cancel_pending_invitations(self):
test_user = self.env['res.users'].sudo().create({'name': "Test User", 'login': 'test'})
test_guest = self.env['mail.guest'].sudo().create({'name': "Test Guest"})
- channel = self.env['mail.channel'].browse(self.env['mail.channel'].create_group(partners_to=(self.user_employee.partner_id + test_user.partner_id).ids)['id'])
+ channel = self.env['discuss.channel'].browse(self.env['discuss.channel'].create_group(partners_to=(self.user_employee.partner_id + test_user.partner_id).ids)['id'])
channel.add_members(guest_ids=test_guest.ids)
channel_member = channel.sudo().channel_member_ids.filtered(lambda channel_member: channel_member.partner_id == self.user_employee.partner_id)
channel_member_test_user = channel.sudo().channel_member_ids.filtered(lambda channel_member: channel_member.partner_id == test_user.partner_id)
@@ -572,12 +572,12 @@ class TestChannelInternals(MailCommon):
(self.cr.dbname, 'res.partner', self.user_employee.partner_id.id), # end session
(self.cr.dbname, 'res.partner', test_user.partner_id.id), # update invitation
(self.cr.dbname, 'mail.guest', test_guest.id), # update invitation
- (self.cr.dbname, 'mail.channel', channel.id), # update list of invitations
- (self.cr.dbname, 'mail.channel', channel.id), # update sessions
+ (self.cr.dbname, 'discuss.channel', channel.id), # update list of invitations
+ (self.cr.dbname, 'discuss.channel', channel.id), # update sessions
],
[
{
- 'type': 'mail.channel.rtc.session/ended',
+ 'type': 'discuss.channel.rtc.session/ended',
'payload': {
'sessionId': channel_member.rtc_session_ids.id,
},
@@ -587,7 +587,7 @@ class TestChannelInternals(MailCommon):
'payload': {
'Thread': {
'id': channel.id,
- 'model': 'mail.channel',
+ 'model': 'discuss.channel',
'rtcInvitingSession': [('unlink',)],
}
},
@@ -597,7 +597,7 @@ class TestChannelInternals(MailCommon):
'payload': {
'Thread': {
'id': channel.id,
- 'model': 'mail.channel',
+ 'model': 'discuss.channel',
'rtcInvitingSession': [('unlink',)],
}
},
@@ -607,7 +607,7 @@ class TestChannelInternals(MailCommon):
'payload': {
'Thread': {
'id': channel.id,
- 'model': 'mail.channel',
+ 'model': 'discuss.channel',
'invitedMembers': [('insert-and-unlink', [
{
'id': channel_member_test_user.id,
@@ -636,7 +636,7 @@ class TestChannelInternals(MailCommon):
},
},
{
- 'type': 'mail.channel/rtc_sessions_update',
+ 'type': 'discuss.channel/rtc_sessions_update',
'payload': {
'id': channel.id,
'rtcSessions': [('insert-and-unlink', [{'id': channel_member.rtc_session_ids.id}])],
@@ -651,7 +651,7 @@ class TestChannelInternals(MailCommon):
def test_30_add_members_while_in_call_should_invite_new_members_to_call(self):
test_user = self.env['res.users'].sudo().create({'name': "Test User", 'login': 'test'})
test_guest = self.env['mail.guest'].sudo().create({'name': "Test Guest"})
- channel = self.env['mail.channel'].browse(self.env['mail.channel'].create_group(partners_to=self.user_employee.partner_id.ids)['id'])
+ channel = self.env['discuss.channel'].browse(self.env['discuss.channel'].create_group(partners_to=self.user_employee.partner_id.ids)['id'])
channel_member = channel.sudo().channel_member_ids.filtered(lambda member: member.partner_id == self.user_employee.partner_id)
channel_member._rtc_join_call()
self.env['bus.bus'].sudo().search([]).unlink()
@@ -664,16 +664,16 @@ class TestChannelInternals(MailCommon):
found_bus_notifs = self.assertBusNotifications(
[
(self.cr.dbname, 'res.partner', test_user.partner_id.id), # channel joined (not asserted below)
- (self.cr.dbname, 'mail.channel', channel.id), # message_post "invited" (not asserted below)
+ (self.cr.dbname, 'discuss.channel', channel.id), # message_post "invited" (not asserted below)
(self.cr.dbname, 'res.partner', self.user_employee.partner_id.id), # update of last interest (not asserted below)
(self.cr.dbname, 'res.partner', test_user.partner_id.id), # update of last interest (not asserted below)
- (self.cr.dbname, 'mail.channel', channel.id), # new members (not asserted below)
+ (self.cr.dbname, 'discuss.channel', channel.id), # new members (not asserted below)
(self.cr.dbname, 'res.partner', test_user.partner_id.id), # incoming invitation
(self.cr.dbname, 'mail.guest', test_guest.id), # incoming invitation
- (self.cr.dbname, 'mail.channel', channel.id), # update list of invitations
+ (self.cr.dbname, 'discuss.channel', channel.id), # update list of invitations
(self.cr.dbname, 'res.partner', self.user_employee.partner_id.id), # update of last interest (not asserted below)
(self.cr.dbname, 'res.partner', test_user.partner_id.id), # update of last interest (not asserted below)
- (self.cr.dbname, 'mail.channel', channel.id), # new member (guest) (not asserted below)
+ (self.cr.dbname, 'discuss.channel', channel.id), # new member (guest) (not asserted below)
(self.cr.dbname, 'mail.guest', test_guest.id), # channel joined for guest (not asserted below)
],
message_items=[
@@ -682,7 +682,7 @@ class TestChannelInternals(MailCommon):
'payload': {
'Thread': {
'id': channel.id,
- 'model': 'mail.channel',
+ 'model': 'discuss.channel',
'rtcInvitingSession': {
'id': channel_member.rtc_session_ids.id,
'channelMember': {
@@ -709,7 +709,7 @@ class TestChannelInternals(MailCommon):
'payload': {
'Thread': {
'id': channel.id,
- 'model': 'mail.channel',
+ 'model': 'discuss.channel',
'rtcInvitingSession': {
'id': channel_member.rtc_session_ids.id,
'channelMember': {
@@ -736,7 +736,7 @@ class TestChannelInternals(MailCommon):
'payload': {
'Thread': {
'id': channel.id,
- 'model': 'mail.channel',
+ 'model': 'discuss.channel',
'invitedMembers': [('insert', [
{
'id': channel_member_test_user.id,
@@ -771,24 +771,24 @@ class TestChannelInternals(MailCommon):
@users('employee')
@mute_logger('odoo.models.unlink')
def test_40_leave_call_should_remove_existing_sessions_of_user_in_channel_and_return_data(self):
- channel = self.env['mail.channel'].browse(self.env['mail.channel'].create_group(partners_to=self.user_employee.partner_id.ids)['id'])
+ channel = self.env['discuss.channel'].browse(self.env['discuss.channel'].create_group(partners_to=self.user_employee.partner_id.ids)['id'])
channel_member = channel.sudo().channel_member_ids.filtered(lambda channel_member: channel_member.partner_id == self.user_employee.partner_id)
channel_member._rtc_join_call()
self.env['bus.bus'].sudo().search([]).unlink()
with self.assertBus(
[
(self.cr.dbname, 'res.partner', self.user_employee.partner_id.id), # end session
- (self.cr.dbname, 'mail.channel', channel.id), # update list of sessions
+ (self.cr.dbname, 'discuss.channel', channel.id), # update list of sessions
],
[
{
- 'type': 'mail.channel.rtc.session/ended',
+ 'type': 'discuss.channel.rtc.session/ended',
'payload': {
'sessionId': channel_member.rtc_session_ids.id,
},
},
{
- 'type': 'mail.channel/rtc_sessions_update',
+ 'type': 'discuss.channel/rtc_sessions_update',
'payload': {
'id': channel.id,
'rtcSessions': [('insert-and-unlink', [{'id': channel_member.rtc_session_ids.id}])],
@@ -801,7 +801,7 @@ class TestChannelInternals(MailCommon):
@users('employee')
@mute_logger('odoo.models.unlink')
def test_50_garbage_collect_should_remove_old_sessions_and_notify_data(self):
- channel = self.env['mail.channel'].browse(self.env['mail.channel'].create_group(partners_to=self.user_employee.partner_id.ids)['id'])
+ channel = self.env['discuss.channel'].browse(self.env['discuss.channel'].create_group(partners_to=self.user_employee.partner_id.ids)['id'])
channel_member = channel.sudo().channel_member_ids.filtered(lambda channel_member: channel_member.partner_id == self.user_employee.partner_id)
channel_member._rtc_join_call()
channel_member.rtc_session_ids.flush_model()
@@ -810,17 +810,17 @@ class TestChannelInternals(MailCommon):
with self.assertBus(
[
(self.cr.dbname, 'res.partner', self.user_employee.partner_id.id), # session ended
- (self.cr.dbname, 'mail.channel', channel.id), # update list of sessions
+ (self.cr.dbname, 'discuss.channel', channel.id), # update list of sessions
],
[
{
- 'type': 'mail.channel.rtc.session/ended',
+ 'type': 'discuss.channel.rtc.session/ended',
'payload': {
'sessionId': channel_member.rtc_session_ids.id,
},
},
{
- 'type': 'mail.channel/rtc_sessions_update',
+ 'type': 'discuss.channel/rtc_sessions_update',
'payload': {
'id': channel.id,
'rtcSessions': [('insert-and-unlink', [{'id': channel_member.rtc_session_ids.id}])],
@@ -828,30 +828,30 @@ class TestChannelInternals(MailCommon):
},
],
):
- self.env['mail.channel.rtc.session'].sudo()._gc_inactive_sessions()
+ self.env['discuss.channel.rtc.session'].sudo()._gc_inactive_sessions()
self.assertFalse(channel_member.rtc_session_ids)
@users('employee')
@mute_logger('odoo.models.unlink')
def test_51_action_disconnect_should_remove_selected_session_and_notify_data(self):
- channel = self.env['mail.channel'].browse(self.env['mail.channel'].create_group(partners_to=self.user_employee.partner_id.ids)['id'])
+ channel = self.env['discuss.channel'].browse(self.env['discuss.channel'].create_group(partners_to=self.user_employee.partner_id.ids)['id'])
channel_member = channel.sudo().channel_member_ids.filtered(lambda channel_member: channel_member.partner_id == self.user_employee.partner_id)
channel_member._rtc_join_call()
self.env['bus.bus'].sudo().search([]).unlink()
with self.assertBus(
[
(self.cr.dbname, 'res.partner', self.user_employee.partner_id.id), # session ended
- (self.cr.dbname, 'mail.channel', channel.id), # update list of sessions
+ (self.cr.dbname, 'discuss.channel', channel.id), # update list of sessions
],
[
{
- 'type': 'mail.channel.rtc.session/ended',
+ 'type': 'discuss.channel.rtc.session/ended',
'payload': {
'sessionId': channel_member.rtc_session_ids.id,
},
},
{
- 'type': 'mail.channel/rtc_sessions_update',
+ 'type': 'discuss.channel/rtc_sessions_update',
'payload': {
'id': channel.id,
'rtcSessions': [('insert-and-unlink', [{'id': channel_member.rtc_session_ids.id}])],
@@ -865,15 +865,15 @@ class TestChannelInternals(MailCommon):
@users('employee')
@mute_logger('odoo.models.unlink')
def test_60_rtc_sync_sessions_should_gc_and_return_outdated_and_active_sessions(self):
- channel = self.env['mail.channel'].browse(self.env['mail.channel'].create_group(partners_to=self.user_employee.partner_id.ids)['id'])
+ channel = self.env['discuss.channel'].browse(self.env['discuss.channel'].create_group(partners_to=self.user_employee.partner_id.ids)['id'])
channel_member = channel.sudo().channel_member_ids.filtered(lambda channel_member: channel_member.partner_id == self.user_employee.partner_id)
join_call_values = channel_member._rtc_join_call()
test_guest = self.env['mail.guest'].sudo().create({'name': "Test Guest"})
- test_channel_member = self.env['mail.channel.member'].create({
+ test_channel_member = self.env['discuss.channel.member'].create({
'guest_id': test_guest.id,
'channel_id': channel.id,
})
- test_session = self.env['mail.channel.rtc.session'].sudo().create({'channel_member_id': test_channel_member.id})
+ test_session = self.env['discuss.channel.rtc.session'].sudo().create({'channel_member_id': test_channel_member.id})
test_session.flush_model()
test_session._write({'write_date': fields.Datetime.now() - relativedelta(days=2)})
unused_ids = [9998, 9999]
@@ -881,17 +881,17 @@ class TestChannelInternals(MailCommon):
with self.assertBus(
[
(self.cr.dbname, 'mail.guest', test_guest.id), # session ended
- (self.cr.dbname, 'mail.channel', channel.id), # update list of sessions
+ (self.cr.dbname, 'discuss.channel', channel.id), # update list of sessions
],
[
{
- 'type': 'mail.channel.rtc.session/ended',
+ 'type': 'discuss.channel.rtc.session/ended',
'payload': {
'sessionId': test_session.id,
},
},
{
- 'type': 'mail.channel/rtc_sessions_update',
+ 'type': 'discuss.channel/rtc_sessions_update',
'payload': {
'id': channel.id,
'rtcSessions': [('insert-and-unlink', [{'id': test_session.id}])],
diff --git a/addons/mail/views/mail_channel_member_views.xml b/addons/mail/views/discuss_channel_member_views.xml
similarity index 71%
rename from addons/mail/views/mail_channel_member_views.xml
rename to addons/mail/views/discuss_channel_member_views.xml
index 090aca2a98e..7a6183f9f0b 100644
--- a/addons/mail/views/mail_channel_member_views.xml
+++ b/addons/mail/views/discuss_channel_member_views.xml
@@ -1,9 +1,9 @@
-
-
- mail.channel.member.tree
- mail.channel.member
+
+
+ discuss.channel.member.tree
+ discuss.channel.member
10
@@ -14,9 +14,9 @@
-
- mail.channel.member.form
- mail.channel.member
+
+ discuss.channel.member.form
+ discuss.channel.member
-
+
Channels/Member
- mail.channel.member
+ discuss.channel.member
tree,form
diff --git a/addons/mail/views/mail_channel_rtc_session_views.xml b/addons/mail/views/discuss_channel_rtc_session_views.xml
similarity index 71%
rename from addons/mail/views/mail_channel_rtc_session_views.xml
rename to addons/mail/views/discuss_channel_rtc_session_views.xml
index 831590fb047..1c819d932d4 100644
--- a/addons/mail/views/mail_channel_rtc_session_views.xml
+++ b/addons/mail/views/discuss_channel_rtc_session_views.xml
@@ -1,9 +1,9 @@
-
- mail.channel.rtc.session.search
- mail.channel.rtc.session
+
+ discuss.channel.rtc.session.search
+ discuss.channel.rtc.session
@@ -12,9 +12,9 @@
-
- mail.channel.rtc.session.tree
- mail.channel.rtc.session
+
+ discuss.channel.rtc.session.tree
+ discuss.channel.rtc.session
-
- mail.channel.rtc.session.form
- mail.channel.rtc.session
+
+ discuss.channel.rtc.session.form
+ discuss.channel.rtc.session
-
+
RTC sessions
- mail.channel.rtc.session
+ discuss.channel.rtc.session
{'search_default_group_by_channel': True}
tree,form
diff --git a/addons/mail/views/mail_channel_views.xml b/addons/mail/views/discuss_channel_views.xml
similarity index 80%
rename from addons/mail/views/mail_channel_views.xml
rename to addons/mail/views/discuss_channel_views.xml
index 18c8944189c..83c802f018f 100644
--- a/addons/mail/views/mail_channel_views.xml
+++ b/addons/mail/views/discuss_channel_views.xml
@@ -1,10 +1,10 @@
-
-
- mail.channel.kanban
- mail.channel
+
+
+ discuss.channel.kanban
+ discuss.channel
@@ -20,11 +20,11 @@