You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-01 13:11:10 +03:00
Handle deletion of m.call events (#9540)
This commit is contained in:
@@ -23,10 +23,10 @@ import { RoomStateEvent } from "matrix-js-sdk/src/models/room-state";
|
|||||||
import { CallType } from "matrix-js-sdk/src/webrtc/call";
|
import { CallType } from "matrix-js-sdk/src/webrtc/call";
|
||||||
import { NamespacedValue } from "matrix-js-sdk/src/NamespacedValue";
|
import { NamespacedValue } from "matrix-js-sdk/src/NamespacedValue";
|
||||||
import { IWidgetApiRequest, MatrixWidgetType } from "matrix-widget-api";
|
import { IWidgetApiRequest, MatrixWidgetType } from "matrix-widget-api";
|
||||||
|
import { MatrixEvent, MatrixEventEvent } from "matrix-js-sdk/src/models/event";
|
||||||
|
|
||||||
import type EventEmitter from "events";
|
import type EventEmitter from "events";
|
||||||
import type { IMyDevice } from "matrix-js-sdk/src/client";
|
import type { IMyDevice } from "matrix-js-sdk/src/client";
|
||||||
import type { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
|
||||||
import type { Room } from "matrix-js-sdk/src/models/room";
|
import type { Room } from "matrix-js-sdk/src/models/room";
|
||||||
import type { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
import type { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
||||||
import type { ClientWidgetApi } from "matrix-widget-api";
|
import type { ClientWidgetApi } from "matrix-widget-api";
|
||||||
@@ -656,6 +656,7 @@ export class ElementCall extends Call {
|
|||||||
client,
|
client,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.groupCall.on(MatrixEventEvent.BeforeRedaction, this.onBeforeRedaction);
|
||||||
this.room.on(RoomStateEvent.Update, this.onRoomState);
|
this.room.on(RoomStateEvent.Update, this.onRoomState);
|
||||||
this.on(CallEvent.ConnectionState, this.onConnectionState);
|
this.on(CallEvent.ConnectionState, this.onConnectionState);
|
||||||
this.on(CallEvent.Participants, this.onParticipants);
|
this.on(CallEvent.Participants, this.onParticipants);
|
||||||
@@ -837,6 +838,7 @@ export class ElementCall extends Call {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public destroy() {
|
public destroy() {
|
||||||
|
this.groupCall.off(MatrixEventEvent.BeforeRedaction, this.onBeforeRedaction);
|
||||||
WidgetStore.instance.removeVirtualWidget(this.widget.id, this.groupCall.getRoomId()!);
|
WidgetStore.instance.removeVirtualWidget(this.widget.id, this.groupCall.getRoomId()!);
|
||||||
this.room.off(RoomStateEvent.Update, this.onRoomState);
|
this.room.off(RoomStateEvent.Update, this.onRoomState);
|
||||||
this.off(CallEvent.ConnectionState, this.onConnectionState);
|
this.off(CallEvent.ConnectionState, this.onConnectionState);
|
||||||
@@ -885,6 +887,10 @@ export class ElementCall extends Call {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private onBeforeRedaction = (): void => {
|
||||||
|
this.disconnect();
|
||||||
|
};
|
||||||
|
|
||||||
private onRoomState = () => {
|
private onRoomState = () => {
|
||||||
this.updateParticipants();
|
this.updateParticipants();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user