Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 9101b42

Browse files
Handle deletion of m.call events (#9540)
1 parent 66d0b31 commit 9101b42

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/models/Call.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ import { RoomStateEvent } from "matrix-js-sdk/src/models/room-state";
2323
import { CallType } from "matrix-js-sdk/src/webrtc/call";
2424
import { NamespacedValue } from "matrix-js-sdk/src/NamespacedValue";
2525
import { IWidgetApiRequest, MatrixWidgetType } from "matrix-widget-api";
26+
import { MatrixEvent, MatrixEventEvent } from "matrix-js-sdk/src/models/event";
2627

2728
import type EventEmitter from "events";
2829
import type { IMyDevice } from "matrix-js-sdk/src/client";
29-
import type { MatrixEvent } from "matrix-js-sdk/src/models/event";
3030
import type { Room } from "matrix-js-sdk/src/models/room";
3131
import type { RoomMember } from "matrix-js-sdk/src/models/room-member";
3232
import type { ClientWidgetApi } from "matrix-widget-api";
@@ -656,6 +656,7 @@ export class ElementCall extends Call {
656656
client,
657657
);
658658

659+
this.groupCall.on(MatrixEventEvent.BeforeRedaction, this.onBeforeRedaction);
659660
this.room.on(RoomStateEvent.Update, this.onRoomState);
660661
this.on(CallEvent.ConnectionState, this.onConnectionState);
661662
this.on(CallEvent.Participants, this.onParticipants);
@@ -837,6 +838,7 @@ export class ElementCall extends Call {
837838
}
838839

839840
public destroy() {
841+
this.groupCall.off(MatrixEventEvent.BeforeRedaction, this.onBeforeRedaction);
840842
WidgetStore.instance.removeVirtualWidget(this.widget.id, this.groupCall.getRoomId()!);
841843
this.room.off(RoomStateEvent.Update, this.onRoomState);
842844
this.off(CallEvent.ConnectionState, this.onConnectionState);
@@ -885,6 +887,10 @@ export class ElementCall extends Call {
885887
);
886888
}
887889

890+
private onBeforeRedaction = (): void => {
891+
this.disconnect();
892+
};
893+
888894
private onRoomState = () => {
889895
this.updateParticipants();
890896

0 commit comments

Comments
 (0)