[FIX] im_livechat, mail: fix add member to livechat channel
Before this commit, inviting a partner to a livechat channel had no effect. This commit solves this issue. Steps to reproduce: - Go to a livechat channel in the discuss app - Click on invite a member on the top right corner - Select a member - Click on the invite button - Nothing happens closes odoo/odoo#128173 X-original-commit: 94086d9289222008f59a97611a80de4e1310e41c Signed-off-by: Sébastien Theys (seb) <seb@odoo.com> Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
/* @odoo-module */
|
||||
|
||||
import { startServer } from "@bus/../tests/helpers/mock_python_environment";
|
||||
|
||||
import { Command } from "@mail/../tests/helpers/command";
|
||||
import { click, start } from "@mail/../tests/helpers/test_utils";
|
||||
|
||||
QUnit.module("Channel invite");
|
||||
|
||||
QUnit.test("Can invite a partner to a livechat channel", async (assert) => {
|
||||
const pyEnv = await startServer();
|
||||
const userId = pyEnv["res.users"].create({ name: "James" });
|
||||
pyEnv["res.partner"].create({
|
||||
name: "James",
|
||||
user_ids: [userId],
|
||||
});
|
||||
const channelId = pyEnv["discuss.channel"].create({
|
||||
anonymous_name: "Visitor 20",
|
||||
name: "Visitor 20",
|
||||
channel_member_ids: [
|
||||
Command.create({ partner_id: pyEnv.currentPartnerId }),
|
||||
Command.create({ partner_id: pyEnv.publicPartnerId }),
|
||||
],
|
||||
channel_type: "livechat",
|
||||
livechat_operator_id: pyEnv.currentPartnerId,
|
||||
});
|
||||
const { openDiscuss } = await start();
|
||||
await openDiscuss(channelId);
|
||||
await click("button[title='Add Users']");
|
||||
await click(".o-discuss-ChannelInvitation-selectable:contains(James) input");
|
||||
await click("button:contains(Invite)");
|
||||
await click("button[title='Show Member List']");
|
||||
assert.containsOnce($, ".o-discuss-ChannelMember:contains(James)");
|
||||
});
|
||||
@@ -105,7 +105,7 @@ export class ChannelInvitation extends Component {
|
||||
...this.state.selectedPartners.map((partner) => partner.id),
|
||||
];
|
||||
await this.threadService.createGroupChat({ partners_to });
|
||||
} else if (["channel", "group"].includes(this.props.thread.type)) {
|
||||
} else {
|
||||
await this.messaging.orm.call(
|
||||
"discuss.channel",
|
||||
"add_members",
|
||||
|
||||
Reference in New Issue
Block a user