Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Start a conference in a room with 2 people + invitee rather than a 1:1 call #7557

Merged
merged 2 commits into from
Jan 17, 2022
Merged
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
7 changes: 4 additions & 3 deletions src/CallHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -809,12 +809,13 @@ export default class CallHandler extends EventEmitter {
// We leave the check for whether there's already a call in this room until later,
// otherwise it can race.

const members = room.getJoinedMembers();
if (members.length <= 1) {
const joinedMemberCount = room.getJoinedMemberCount();
const invitedAndJoinedMemberCount = room.getInvitedAndJoinedMemberCount();
if (joinedMemberCount <= 1) {
Modal.createTrackedDialog('Call Handler', 'Cannot place call with self', ErrorDialog, {
description: _t('You cannot place a call with yourself.'),
});
} else if (members.length === 2) {
} else if (invitedAndJoinedMemberCount === 2) {
logger.info(`Place ${type} call in ${roomId}`);

this.placeMatrixCall(roomId, type, transferee);
Expand Down
2 changes: 2 additions & 0 deletions test/CallHandler-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ function mkStubDM(roomId, userId) {
getMxcAvatarUrl: () => 'mxc://avatar.url/image.png',
},
]);
room.getJoinedMemberCount = jest.fn().mockReturnValue(room.getJoinedMembers().length);
room.getInvitedAndJoinedMemberCount = jest.fn().mockReturnValue(room.getJoinedMembers().length);
room.currentState.getMembers = room.getJoinedMembers;

return room;
Expand Down