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

Switch callEventHandler from listening on event to Room.timeline

so that it doesn't end up processing ephemerals, account data, remote echoes, etc etc
This commit is contained in:
Michael Telatynski
2021-07-15 17:44:17 +01:00
parent dbe93f598a
commit d383e71aca

View File

@@ -47,12 +47,12 @@ export class CallEventHandler {
public start() {
this.client.on("sync", this.evaluateEventBuffer);
this.client.on("event", this.onEvent);
this.client.on("Room.timeline", this.onRoomTimeline);
}
public stop() {
this.client.removeListener("sync", this.evaluateEventBuffer);
this.client.removeListener("event", this.onEvent);
this.client.removeListener("Room.timeline", this.onRoomTimeline);
}
private evaluateEventBuffer = async () => {
@@ -89,7 +89,7 @@ export class CallEventHandler {
}
};
private onEvent = (event: MatrixEvent) => {
private onRoomTimeline = (event: MatrixEvent) => {
this.client.decryptEventIfNeeded(event);
// any call events or ones that might be once they're decrypted
if (this.eventIsACall(event) || event.isBeingDecrypted()) {