1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Hopefully make if statement clearer

This commit is contained in:
David Baker
2020-10-09 17:26:06 +01:00
parent f845100062
commit 9d9c2720c2

View File

@@ -166,10 +166,15 @@ export class CallEventHandler {
// Were we trying to call that user (room)?
let existingCall;
for (const thisCall of this.calls.values()) {
if (call.roomId === thisCall.roomId &&
thisCall.direction === CallDirection.Outbound &&
([CallState.WaitLocalMedia, CallState.CreateOffer, CallState.InviteSent].indexOf(
thisCall.state) !== -1)) {
const isCalling = [CallState.WaitLocalMedia, CallState.CreateOffer, CallState.InviteSent].includes(
thisCall.state,
);
if (
call.roomId === thisCall.roomId &&
thisCall.direction === CallDirection.Outbound &&
isCalling
) {
existingCall = thisCall;
break;
}