You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-07 21:23:00 +03:00
Handle group call redaction (#10465)
Redacted group call events should be interpreted as terminated calls.
This commit is contained in:
@@ -114,6 +114,14 @@ describe("CallEvent", () => {
|
||||
screen.getByText("1m 30s");
|
||||
});
|
||||
|
||||
it("shows a message if the call was redacted", () => {
|
||||
const event = room.currentState.getStateEvents(MockedCall.EVENT_TYPE, "1")!;
|
||||
jest.spyOn(event, "isRedacted").mockReturnValue(true);
|
||||
renderEvent();
|
||||
|
||||
screen.getByText("Video call ended");
|
||||
});
|
||||
|
||||
it("shows placeholder info if the call isn't loaded yet", () => {
|
||||
jest.spyOn(CallStore.instance, "getCall").mockReturnValue(null);
|
||||
jest.advanceTimersByTime(90000);
|
||||
|
@@ -21,6 +21,7 @@ import { Room } from "matrix-js-sdk/src/models/room";
|
||||
import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||
import { RoomStateEvent } from "matrix-js-sdk/src/models/room-state";
|
||||
import { ClientWidgetApi, Widget } from "matrix-widget-api";
|
||||
import { MatrixEvent, MatrixEventEvent } from "matrix-js-sdk/src/models/event";
|
||||
|
||||
import type { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
||||
import {
|
||||
@@ -176,4 +177,15 @@ describe("IncomingCallEvent", () => {
|
||||
expect(toastStore.dismissToast).toHaveBeenCalledWith(getIncomingCallToastKey(call.event.getStateKey()!)),
|
||||
);
|
||||
});
|
||||
|
||||
it("closes toast when the call event is redacted", async () => {
|
||||
renderToast();
|
||||
|
||||
const event = room.currentState.getStateEvents(MockedCall.EVENT_TYPE, "1")!;
|
||||
event.emit(MatrixEventEvent.BeforeRedaction, event, {} as unknown as MatrixEvent);
|
||||
|
||||
await waitFor(() =>
|
||||
expect(toastStore.dismissToast).toHaveBeenCalledWith(getIncomingCallToastKey(call.event.getStateKey()!)),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user