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

Fix up more types & Sonar warnings (#2363)

* Fix up more types & Sonar warnings

* Fix test

* Add first test for callEventHandler
This commit is contained in:
Michael Telatynski
2022-05-12 10:12:39 +01:00
committed by GitHub
parent 4d4d6e1411
commit 4721aa1d24
10 changed files with 119 additions and 37 deletions

View File

@@ -72,21 +72,17 @@ export class CallEventHandler {
this.client.decryptEventIfNeeded(event);
}));
const ignoreCallIds = new Set<String>();
const ignoreCallIds = new Set<string>();
// inspect the buffer and mark all calls which have been answered
// or hung up before passing them to the call event handler.
for (const ev of this.callEventBuffer) {
if (ev.getType() === EventType.CallAnswer ||
ev.getType() === EventType.CallHangup) {
if (ev.getType() === EventType.CallAnswer || ev.getType() === EventType.CallHangup) {
ignoreCallIds.add(ev.getContent().call_id);
}
}
// now loop through the buffer chronologically and inject them
for (const e of this.callEventBuffer) {
if (
e.getType() === EventType.CallInvite &&
ignoreCallIds.has(e.getContent().call_id)
) {
if (e.getType() === EventType.CallInvite && ignoreCallIds.has(e.getContent().call_id)) {
// This call has previously been answered or hung up: ignore it
continue;
}
@@ -191,7 +187,7 @@ export class CallEventHandler {
}
// Were we trying to call that user (room)?
let existingCall;
let existingCall: MatrixCall;
for (const thisCall of this.calls.values()) {
const isCalling = [CallState.WaitLocalMedia, CallState.CreateOffer, CallState.InviteSent].includes(
thisCall.state,