You've already forked matrix-js-sdk
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:
@@ -131,11 +131,12 @@ export class CallEventHandler {
|
|||||||
private handleCallEvent(event: MatrixEvent) {
|
private handleCallEvent(event: MatrixEvent) {
|
||||||
const content = event.getContent();
|
const content = event.getContent();
|
||||||
const type = event.getType() as EventType;
|
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;
|
let call = content.call_id ? this.calls.get(content.call_id) : undefined;
|
||||||
//console.info("RECV %s content=%s", type, JSON.stringify(content));
|
//console.info("RECV %s content=%s", type, JSON.stringify(content));
|
||||||
|
|
||||||
if (type === EventType.CallInvite) {
|
if (type === EventType.CallInvite) {
|
||||||
if (event.getSender() === this.client.credentials.userId) {
|
if (weSentTheEvent) {
|
||||||
return; // ignore invites you send
|
return; // ignore invites you send
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +223,7 @@ export class CallEventHandler {
|
|||||||
this.client.emit("Call.incoming", call);
|
this.client.emit("Call.incoming", call);
|
||||||
}
|
}
|
||||||
} else if (type === EventType.CallCandidates) {
|
} else if (type === EventType.CallCandidates) {
|
||||||
if (event.getSender() === this.client.credentials.userId) {
|
if (weSentTheEvent) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!call) {
|
if (!call) {
|
||||||
@@ -266,7 +267,7 @@ export class CallEventHandler {
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EventType.CallAnswer:
|
case EventType.CallAnswer:
|
||||||
if (event.getSender() === this.client.credentials.userId) {
|
if (weSentTheEvent) {
|
||||||
if (call.state === CallState.Ringing) {
|
if (call.state === CallState.Ringing) {
|
||||||
call.onAnsweredElsewhere(content);
|
call.onAnsweredElsewhere(content);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user