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

Extract weSentTheEvent into a variable

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner
2021-08-03 09:37:41 +02:00
parent 904071ebe6
commit dd3c53edac

View File

@@ -131,11 +131,12 @@ export class CallEventHandler {
private handleCallEvent(event: MatrixEvent) {
const content = event.getContent();
const type = event.getType() as EventType;
const weSentTheEvent = event.getSender() === this.client.credentials.userId;
let call = content.call_id ? this.calls.get(content.call_id) : undefined;
//console.info("RECV %s content=%s", type, JSON.stringify(content));
if (type === EventType.CallInvite) {
if (event.getSender() === this.client.credentials.userId) {
if (weSentTheEvent) {
return; // ignore invites you send
}
@@ -222,7 +223,7 @@ export class CallEventHandler {
this.client.emit("Call.incoming", call);
}
} else if (type === EventType.CallCandidates) {
if (event.getSender() === this.client.credentials.userId) {
if (weSentTheEvent) {
return;
}
if (!call) {
@@ -266,7 +267,7 @@ export class CallEventHandler {
switch (type) {
case EventType.CallAnswer:
if (event.getSender() === this.client.credentials.userId) {
if (weSentTheEvent) {
if (call.state === CallState.Ringing) {
call.onAnsweredElsewhere(content);
}