From 8fcb6e8aadeb906c079251a1e426f4bec61dd483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Mon, 17 Jan 2022 13:43:05 +0100 Subject: [PATCH 1/2] Start a conference call in a room with 2 people + invitee rather than a 1:1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/CallHandler.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/CallHandler.tsx b/src/CallHandler.tsx index 5d4973798d6..f4bf86c6b2a 100644 --- a/src/CallHandler.tsx +++ b/src/CallHandler.tsx @@ -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); From 81c1210866a29eae71e42662c5a3f7ec5891f69e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Mon, 17 Jan 2022 14:21:29 +0100 Subject: [PATCH 2/2] Fix tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- test/CallHandler-test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/CallHandler-test.ts b/test/CallHandler-test.ts index 6aaf8cbe1bf..e9515e0db5a 100644 --- a/test/CallHandler-test.ts +++ b/test/CallHandler-test.ts @@ -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;