Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class ChannelInvitation extends Component {
super.setup();
this.orm = useService("orm");
this.store = useService("mail.store");
this.rtc = useService("discuss.rtc");
this.notification = useService("notification");
this.suggestionService = useService("mail.suggestion");
this.ui = useService("ui");
Expand Down Expand Up @@ -164,6 +165,7 @@ export class ChannelInvitation extends Component {
} else {
await this.orm.call("discuss.channel", "add_members", [[this.props.thread.id]], {
partner_ids: this.selectedPartners.map((partner) => partner.id),
invite_to_rtc_call: this.rtc.state.channel?.eq(this.props.thread),
});
}
this.props.close();
Expand Down
24 changes: 24 additions & 0 deletions addons/mail/static/tests/discuss/call/call.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -604,3 +604,27 @@ test("automatically cancel incoming call after some time", async () => {
await advanceTime(30_000);
await contains(".o-discuss-CallInvitation", { count: 0 });
});

test("should also invite to the call when inviting to the channel", async () => {
mockGetMedia();
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({
email: "testpartner@odoo.com",
name: "TestPartner",
});
pyEnv["res.users"].create({ partner_id: partnerId });
const channelId = pyEnv["discuss.channel"].create({
name: "TestChanel",
channel_member_ids: [Command.create({ partner_id: serverState.partnerId })],
channel_type: "channel",
});
await start();
await openDiscuss(channelId);
await click("[title='Start a Call']");
await contains(".o-discuss-Call");
await click(".o-mail-Discuss-header button[title='Invite People']");
await contains(".o-discuss-ChannelInvitation");
await click(".o-discuss-ChannelInvitation-selectable", { text: "TestPartner" });
await click("[title='Invite to Channel']:enabled");
await contains(".o-discuss-CallParticipantCard.o-isInvitation");
});
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ export class DiscussChannel extends models.ServerModel {
/**
* @param {number[]} ids
* @param {number[]} partner_ids
* @param {boolean} [invite_to_rtc_call=undefined]
*/
add_members(ids, partner_ids) {
const kwargs = getKwArgs(arguments, "ids", "partner_ids");
add_members(ids, partner_ids, invite_to_rtc_call) {
const kwargs = getKwArgs(arguments, "ids", "partner_ids", "invite_to_rtc_call");
ids = kwargs.ids;
delete kwargs.ids;
partner_ids = kwargs.partner_ids || [];
Expand Down Expand Up @@ -170,6 +171,9 @@ export class DiscussChannel extends models.ServerModel {
member_count: DiscussChannelMember.search_count([
["channel_id", "=", channel.id],
]),
invitedMembers: kwargs.invite_to_rtc_call
? [["ADD", insertedChannelMembers]]
: false,
})
.add(DiscussChannelMember.browse(insertedChannelMembers))
.get_result()
Expand Down