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

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

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

* Fix tests

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
pull/21833/head
Šimon Brandner 2022-01-17 21:46:55 +01:00 committed by GitHub
parent 65987e6b72
commit 8ced6e6117
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -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, // We leave the check for whether there's already a call in this room until later,
// otherwise it can race. // otherwise it can race.
const members = room.getJoinedMembers(); const joinedMemberCount = room.getJoinedMemberCount();
if (members.length <= 1) { const invitedAndJoinedMemberCount = room.getInvitedAndJoinedMemberCount();
if (joinedMemberCount <= 1) {
Modal.createTrackedDialog('Call Handler', 'Cannot place call with self', ErrorDialog, { Modal.createTrackedDialog('Call Handler', 'Cannot place call with self', ErrorDialog, {
description: _t('You cannot place a call with yourself.'), 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}`); logger.info(`Place ${type} call in ${roomId}`);
this.placeMatrixCall(roomId, type, transferee); this.placeMatrixCall(roomId, type, transferee);

View File

@ -54,6 +54,8 @@ function mkStubDM(roomId, userId) {
getMxcAvatarUrl: () => 'mxc://avatar.url/image.png', 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; room.currentState.getMembers = room.getJoinedMembers;
return room; return room;