diff --git a/src/ContentMessages.ts b/src/ContentMessages.ts index 0a5198ea567..b0f29ba044d 100644 --- a/src/ContentMessages.ts +++ b/src/ContentMessages.ts @@ -19,7 +19,6 @@ limitations under the License. import { MatrixClient, MsgType, - IImageInfo, HTTPError, IEventRelation, ISendEventResponse, @@ -390,7 +389,7 @@ export default class ContentMessages { url: string, roomId: string, threadId: string | null, - info: IImageInfo, + info: ImageInfo, text: string, matrixClient: MatrixClient, ): Promise { diff --git a/src/ScalarMessaging.ts b/src/ScalarMessaging.ts index 3b17bf7836c..0ee6921a24d 100644 --- a/src/ScalarMessaging.ts +++ b/src/ScalarMessaging.ts @@ -612,15 +612,7 @@ async function setBotPower( }); } } - await client.setPowerLevel( - roomId, - userId, - level, - new MatrixEvent({ - type: "m.room.power_levels", - content: powerLevels, - }), - ); + await client.setPowerLevel(roomId, userId, level); return sendResponse(event, { success: true, }); diff --git a/src/components/structures/InteractiveAuth.tsx b/src/components/structures/InteractiveAuth.tsx index 2547af77a1d..1ca2b6e5ce3 100644 --- a/src/components/structures/InteractiveAuth.tsx +++ b/src/components/structures/InteractiveAuth.tsx @@ -18,7 +18,7 @@ import React, { createRef } from "react"; import { AuthType, IAuthData, - IAuthDict, + AuthDict, IInputs, InteractiveAuth, IStageStatus, @@ -64,7 +64,7 @@ export interface InteractiveAuthProps { continueText?: string; continueKind?: ContinueKind; // callback - makeRequest(auth: IAuthDict | null): Promise; + makeRequest(auth: AuthDict | null): Promise; // callback called when the auth process has finished, // successfully or unsuccessfully. // @param {boolean} status True if the operation requiring @@ -213,7 +213,7 @@ export default class InteractiveAuthComponent extends React.Component => { + private requestCallback = (auth: AuthDict | null, background: boolean): Promise => { // This wrapper just exists because the js-sdk passes a second // 'busy' param for backwards compat. This throws the tests off // so discard it here. @@ -246,7 +246,7 @@ export default class InteractiveAuthComponent extends React.Component { + private submitAuthDict = (authData: AuthDict): void => { this.authLogic.submitAuthDict(authData); }; diff --git a/src/components/structures/auth/Registration.tsx b/src/components/structures/auth/Registration.tsx index 4da7282660e..5ac49537c58 100644 --- a/src/components/structures/auth/Registration.tsx +++ b/src/components/structures/auth/Registration.tsx @@ -18,7 +18,7 @@ import { AuthType, createClient, IAuthData, - IAuthDict, + AuthDict, IInputs, MatrixError, IRegisterRequestParams, @@ -478,7 +478,7 @@ export default class Registration extends React.Component { }); }; - private makeRegisterRequest = (auth: IAuthDict | null): Promise => { + private makeRegisterRequest = (auth: AuthDict | null): Promise => { if (!this.state.matrixClient) throw new Error("Matrix client has not yet been loaded"); const registerParams: IRegisterRequestParams = { diff --git a/src/components/views/auth/InteractiveAuthEntryComponents.tsx b/src/components/views/auth/InteractiveAuthEntryComponents.tsx index 0a7ed19b2ab..e8969f12adf 100644 --- a/src/components/views/auth/InteractiveAuthEntryComponents.tsx +++ b/src/components/views/auth/InteractiveAuthEntryComponents.tsx @@ -16,7 +16,7 @@ limitations under the License. import classNames from "classnames"; import { MatrixClient } from "matrix-js-sdk/src/matrix"; -import { AuthType, IAuthDict, IInputs, IStageStatus } from "matrix-js-sdk/src/interactive-auth"; +import { AuthType, AuthDict, IInputs, IStageStatus } from "matrix-js-sdk/src/interactive-auth"; import { logger } from "matrix-js-sdk/src/logger"; import React, { ChangeEvent, createRef, FormEvent, Fragment } from "react"; @@ -89,7 +89,7 @@ interface IAuthEntryProps { // Is the auth logic currently waiting for something to happen? busy?: boolean; onPhaseChange: (phase: number) => void; - submitAuthDict: (auth: IAuthDict) => void; + submitAuthDict: (auth: AuthDict) => void; requestEmailToken?: () => Promise; fail: (error: Error) => void; clientSecret: string; diff --git a/src/components/views/right_panel/UserInfo.tsx b/src/components/views/right_panel/UserInfo.tsx index aa7b54ddf97..63996612430 100644 --- a/src/components/views/right_panel/UserInfo.tsx +++ b/src/components/views/right_panel/UserInfo.tsx @@ -932,7 +932,7 @@ const MuteToggleButton: React.FC = ({ return; } - cli.setPowerLevel(roomId, target, level, powerLevelEvent) + cli.setPowerLevel(roomId, target, level) .then( () => { // NO-OP; rely on the m.room.member event coming down else we could @@ -1159,13 +1159,8 @@ export const PowerLevelEditor: React.FC<{ async (powerLevel: number) => { setSelectedPowerLevel(powerLevel); - const applyPowerChange = ( - roomId: string, - target: string, - powerLevel: number, - powerLevelEvent: MatrixEvent, - ): Promise => { - return cli.setPowerLevel(roomId, target, powerLevel, powerLevelEvent).then( + const applyPowerChange = (roomId: string, target: string, powerLevel: number): Promise => { + return cli.setPowerLevel(roomId, target, powerLevel).then( function () { // NO-OP; rely on the m.room.member event coming down else we could // get out of sync if we force setState here! @@ -1213,7 +1208,7 @@ export const PowerLevelEditor: React.FC<{ } } - await applyPowerChange(roomId, target, powerLevel, powerLevelEvent); + await applyPowerChange(roomId, target, powerLevel); }, [user.roomId, user.userId, cli, room], ); diff --git a/src/components/views/settings/AddPrivilegedUsers.tsx b/src/components/views/settings/AddPrivilegedUsers.tsx index d8d26593714..5bcaecd4691 100644 --- a/src/components/views/settings/AddPrivilegedUsers.tsx +++ b/src/components/views/settings/AddPrivilegedUsers.tsx @@ -62,7 +62,7 @@ export const AddPrivilegedUsers: React.FC = ({ room, de } try { - await client.setPowerLevel(room.roomId, userIds, powerLevel, powerLevelEvent); + await client.setPowerLevel(room.roomId, userIds, powerLevel); setSelectedUsers([]); setPowerLevel(defaultUserLevel); } catch (error) { diff --git a/src/components/views/settings/devices/deleteDevices.tsx b/src/components/views/settings/devices/deleteDevices.tsx index c07757f7a9b..e42dbe10b9b 100644 --- a/src/components/views/settings/devices/deleteDevices.tsx +++ b/src/components/views/settings/devices/deleteDevices.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import { MatrixClient, MatrixError } from "matrix-js-sdk/src/matrix"; -import { IAuthDict, IAuthData } from "matrix-js-sdk/src/interactive-auth"; +import { AuthDict, IAuthData } from "matrix-js-sdk/src/interactive-auth"; import { _t } from "../../../../languageHandler"; import Modal from "../../../../Modal"; @@ -25,7 +25,7 @@ import InteractiveAuthDialog from "../../dialogs/InteractiveAuthDialog"; const makeDeleteRequest = (matrixClient: MatrixClient, deviceIds: string[]) => - async (auth: IAuthDict | null): Promise => { + async (auth: AuthDict | null): Promise => { return matrixClient.deleteMultipleDevices(deviceIds, auth ?? undefined); }; diff --git a/src/createRoom.ts b/src/createRoom.ts index 579eeab7f30..93ef63383f4 100644 --- a/src/createRoom.ts +++ b/src/createRoom.ts @@ -347,15 +347,13 @@ export default async function createRoom(client: MatrixClient, opts: IOpts): Pro await JitsiCall.create(await room); // Reset our power level back to admin so that the widget becomes immutable - const plEvent = (await room).currentState.getStateEvents(EventType.RoomPowerLevels, ""); - await client.setPowerLevel(roomId, client.getUserId()!, 100, plEvent); + await client.setPowerLevel(roomId, client.getUserId()!, 100); } else if (opts.roomType === RoomType.UnstableCall) { // Set up this video room with an Element call await ElementCall.create(await room); // Reset our power level back to admin so that the call becomes immutable - const plEvent = (await room).currentState.getStateEvents(EventType.RoomPowerLevels, ""); - await client.setPowerLevel(roomId, client.getUserId()!, 100, plEvent); + await client.setPowerLevel(roomId, client.getUserId()!, 100); } }) .then( diff --git a/src/utils/exportUtils/JSONExport.ts b/src/utils/exportUtils/JSONExport.ts index d0470576d23..8805f95d65f 100644 --- a/src/utils/exportUtils/JSONExport.ts +++ b/src/utils/exportUtils/JSONExport.ts @@ -74,9 +74,7 @@ export default class JSONExporter extends Exporter { logger.log("Error fetching file: " + err); } } - const jsonEvent: any = mxEv.toJSON(); - const clearEvent = mxEv.isEncrypted() ? jsonEvent.decrypted : jsonEvent; - return clearEvent; + return mxEv.getEffectiveEvent(); } protected async createOutput(events: MatrixEvent[]): Promise { diff --git a/test/ContentMessages-test.ts b/test/ContentMessages-test.ts index a54ad29ab78..231ddc1b20e 100644 --- a/test/ContentMessages-test.ts +++ b/test/ContentMessages-test.ts @@ -15,7 +15,8 @@ limitations under the License. */ import { mocked } from "jest-mock"; -import { IImageInfo, ISendEventResponse, MatrixClient, RelationType, UploadResponse } from "matrix-js-sdk/src/matrix"; +import { ISendEventResponse, MatrixClient, RelationType, UploadResponse } from "matrix-js-sdk/src/matrix"; +import { ImageInfo } from "matrix-js-sdk/src/types"; import { defer } from "matrix-js-sdk/src/utils"; import encrypt, { IEncryptedFile } from "matrix-encrypt-attachment"; @@ -43,7 +44,7 @@ const createElement = document.createElement.bind(document); describe("ContentMessages", () => { const stickerUrl = "https://example.com/sticker"; const roomId = "!room:example.com"; - const imageInfo = {} as unknown as IImageInfo; + const imageInfo = {} as unknown as ImageInfo; const text = "test sticker"; let client: MatrixClient; let contentMessages: ContentMessages; diff --git a/test/Reply-test.ts b/test/Reply-test.ts index ac64610ec7a..b7ae3c9eefd 100644 --- a/test/Reply-test.ts +++ b/test/Reply-test.ts @@ -22,6 +22,7 @@ import { LocationAssetType, M_ASSET, M_POLL_END, + Room, } from "matrix-js-sdk/src/matrix"; import { @@ -31,7 +32,7 @@ import { stripHTMLReply, stripPlainReply, } from "../src/utils/Reply"; -import { makePollStartEvent, mkEvent } from "./test-utils"; +import { makePollStartEvent, mkEvent, stubClient } from "./test-utils"; import { RoomPermalinkCreator } from "../src/utils/permalinks/Permalinks"; function makeTestEvent(type: string, content: IContent): MatrixEvent { @@ -66,7 +67,7 @@ describe("Reply", () => { room: "!room1:server", content: {}, }); - event.makeRedacted(event); + event.makeRedacted(event, new Room(event.getRoomId()!, stubClient(), event.getSender()!)); expect(getParentEventId(event)).toBeUndefined(); }); @@ -182,7 +183,7 @@ But this is not room: "!room1:server", content: {}, }); - event.makeRedacted(event); + event.makeRedacted(event, new Room(event.getRoomId()!, stubClient(), event.getSender()!)); expect(shouldDisplayReply(event)).toBe(false); }); diff --git a/test/TextForEvent-test.ts b/test/TextForEvent-test.ts index a389333dc47..ff1e0a06bc9 100644 --- a/test/TextForEvent-test.ts +++ b/test/TextForEvent-test.ts @@ -419,7 +419,7 @@ describe("TextForEvent", () => { }); it("returns correct message for redacted poll start", () => { - pollEvent.makeRedacted(pollEvent); + pollEvent.makeRedacted(pollEvent, new Room(pollEvent.getRoomId()!, mockClient, mockClient.getSafeUserId())); expect(textForEvent(pollEvent, mockClient)).toEqual("@a: Message deleted"); }); @@ -445,7 +445,10 @@ describe("TextForEvent", () => { }); it("returns correct message for redacted message", () => { - messageEvent.makeRedacted(messageEvent); + messageEvent.makeRedacted( + messageEvent, + new Room(messageEvent.getRoomId()!, mockClient, mockClient.getSafeUserId()), + ); expect(textForEvent(messageEvent, mockClient)).toEqual("@a: Message deleted"); }); diff --git a/test/Unread-test.ts b/test/Unread-test.ts index 5caeeb7f346..8d4f319a398 100644 --- a/test/Unread-test.ts +++ b/test/Unread-test.ts @@ -63,7 +63,7 @@ describe("Unread", () => { type: EventType.RoomMessage, sender: aliceId, }); - redactedEvent.makeRedacted(redactedEvent); + redactedEvent.makeRedacted(redactedEvent, new Room(redactedEvent.getRoomId()!, client, aliceId)); beforeEach(() => { jest.clearAllMocks(); @@ -408,7 +408,7 @@ describe("Unread", () => { content: {}, }); console.log("Event Id", redactedEvent.getId()); - redactedEvent.makeRedacted(redactedEvent); + redactedEvent.makeRedacted(redactedEvent, room); console.log("Event Id", redactedEvent.getId()); // Only for timeline events. room.addLiveEvents([redactedEvent]); diff --git a/test/components/structures/ViewSource-test.tsx b/test/components/structures/ViewSource-test.tsx index 44c122e901d..8f2559dff90 100644 --- a/test/components/structures/ViewSource-test.tsx +++ b/test/components/structures/ViewSource-test.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import { render } from "@testing-library/react"; -import { EventType, MatrixEvent } from "matrix-js-sdk/src/matrix"; +import { EventType, MatrixEvent, Room } from "matrix-js-sdk/src/matrix"; import React from "react"; import ViewSource from "../../../src/components/structures/ViewSource"; @@ -43,7 +43,7 @@ describe("ViewSource", () => { content: {}, state_key: undefined, }); - redactedMessageEvent.makeRedacted(redactionEvent); + redactedMessageEvent.makeRedacted(redactionEvent, new Room(ROOM_ID, stubClient(), SENDER)); }); beforeEach(stubClient); diff --git a/test/components/views/messages/MBeaconBody-test.tsx b/test/components/views/messages/MBeaconBody-test.tsx index 694df7f24a4..aa1da83e508 100644 --- a/test/components/views/messages/MBeaconBody-test.tsx +++ b/test/components/views/messages/MBeaconBody-test.tsx @@ -25,6 +25,7 @@ import { EventType, Relations, M_BEACON, + Room, } from "matrix-js-sdk/src/matrix"; import MBeaconBody from "../../../../src/components/views/messages/MBeaconBody"; @@ -304,10 +305,11 @@ describe("", () => { const redactionEvent = new MatrixEvent({ type: EventType.RoomRedaction, content: { reason: "test reason" } }); - const setupRoomWithBeacon = (beaconInfoEvent: MatrixEvent, locationEvents: MatrixEvent[] = []) => { + const setupRoomWithBeacon = (beaconInfoEvent: MatrixEvent, locationEvents: MatrixEvent[] = []): Room => { const room = makeRoomWithStateEvents([beaconInfoEvent], { roomId, mockClient }); const beaconInstance = room.currentState.beacons.get(getBeaconInfoIdentifier(beaconInfoEvent))!; beaconInstance.addLocations(locationEvents); + return room; }; const mockGetRelationsForEvent = (locationEvents: MatrixEvent[] = []) => { const relations = new Relations(RelationType.Reference, M_BEACON.name, mockClient); @@ -320,12 +322,12 @@ describe("", () => { it("does nothing when getRelationsForEvent is falsy", () => { const { beaconInfoEvent, location1, location2 } = makeEvents(); - setupRoomWithBeacon(beaconInfoEvent, [location1, location2]); + const room = setupRoomWithBeacon(beaconInfoEvent, [location1, location2]); getComponent({ mxEvent: beaconInfoEvent }); act(() => { - beaconInfoEvent.makeRedacted(redactionEvent); + beaconInfoEvent.makeRedacted(redactionEvent, room); }); // no error, no redactions @@ -349,13 +351,13 @@ describe("", () => { it("does nothing when beacon has no related locations", async () => { const { beaconInfoEvent } = makeEvents(); // no locations - setupRoomWithBeacon(beaconInfoEvent, []); + const room = setupRoomWithBeacon(beaconInfoEvent, []); const getRelationsForEvent = await mockGetRelationsForEvent(); getComponent({ mxEvent: beaconInfoEvent, getRelationsForEvent }); act(() => { - beaconInfoEvent.makeRedacted(redactionEvent); + beaconInfoEvent.makeRedacted(redactionEvent, room); }); expect(getRelationsForEvent).toHaveBeenCalledWith( @@ -368,14 +370,14 @@ describe("", () => { it("redacts related locations on beacon redaction", async () => { const { beaconInfoEvent, location1, location2 } = makeEvents(); - setupRoomWithBeacon(beaconInfoEvent, [location1, location2]); + const room = setupRoomWithBeacon(beaconInfoEvent, [location1, location2]); const getRelationsForEvent = await mockGetRelationsForEvent([location1, location2]); getComponent({ mxEvent: beaconInfoEvent, getRelationsForEvent }); act(() => { - beaconInfoEvent.makeRedacted(redactionEvent); + beaconInfoEvent.makeRedacted(redactionEvent, room); }); expect(getRelationsForEvent).toHaveBeenCalledWith( diff --git a/test/components/views/messages/MPollEndBody-test.tsx b/test/components/views/messages/MPollEndBody-test.tsx index 4585f4d813d..f972e40bfd5 100644 --- a/test/components/views/messages/MPollEndBody-test.tsx +++ b/test/components/views/messages/MPollEndBody-test.tsx @@ -96,7 +96,7 @@ describe("", () => { mockClient.relations.mockResolvedValue({ events: [], }); - mockClient.fetchRoomEvent.mockResolvedValue(pollStartEvent.toJSON()); + mockClient.fetchRoomEvent.mockResolvedValue(pollStartEvent.getEffectiveEvent()); }); afterEach(() => { diff --git a/test/components/views/messages/MessageActionBar-test.tsx b/test/components/views/messages/MessageActionBar-test.tsx index 8f2fbe02a03..33d1f0d8eed 100644 --- a/test/components/views/messages/MessageActionBar-test.tsx +++ b/test/components/views/messages/MessageActionBar-test.tsx @@ -46,6 +46,14 @@ jest.mock("../../../../src/dispatcher/dispatcher"); describe("", () => { const userId = "@alice:server.org"; const roomId = "!room:server.org"; + + const client = getMockClientWithEventEmitter({ + ...mockClientMethodsUser(userId), + ...mockClientMethodsEvents(), + getRoom: jest.fn(), + }); + const room = new Room(roomId, client, userId); + const alicesMessageEvent = new MatrixEvent({ type: EventType.RoomMessage, sender: userId, @@ -72,13 +80,7 @@ describe("", () => { type: EventType.RoomMessage, sender: userId, }); - redactedEvent.makeRedacted(redactedEvent); - - const client = getMockClientWithEventEmitter({ - ...mockClientMethodsUser(userId), - ...mockClientMethodsEvents(), - getRoom: jest.fn(), - }); + redactedEvent.makeRedacted(redactedEvent, room); const localStorageMock = (() => { let store: Record = {}; @@ -98,7 +100,6 @@ describe("", () => { writable: true, }); - const room = new Room(roomId, client, userId); jest.spyOn(room, "getPendingEvents").mockReturnValue([]); client.getRoom.mockReturnValue(room); diff --git a/test/components/views/right_panel/UserInfo-test.tsx b/test/components/views/right_panel/UserInfo-test.tsx index 789ae075bf9..5130a2bcdde 100644 --- a/test/components/views/right_panel/UserInfo-test.tsx +++ b/test/components/views/right_panel/UserInfo-test.tsx @@ -933,12 +933,7 @@ describe("", () => { // firing the event will raise a dialog warning about self demotion, wait for this to appear then click on it await userEvent.click(await screen.findByText("Demote", { exact: true })); expect(mockClient.setPowerLevel).toHaveBeenCalledTimes(1); - expect(mockClient.setPowerLevel).toHaveBeenCalledWith( - mockRoom.roomId, - defaultMember.userId, - changedPowerLevel, - powerLevelEvent, - ); + expect(mockClient.setPowerLevel).toHaveBeenCalledWith(mockRoom.roomId, defaultMember.userId, changedPowerLevel); }); }); diff --git a/test/createRoom-test.ts b/test/createRoom-test.ts index 91b274c6df7..eeca9532698 100644 --- a/test/createRoom-test.ts +++ b/test/createRoom-test.ts @@ -70,7 +70,7 @@ describe("createRoom", () => { // widget should be immutable for admins expect(widgetPower).toBeGreaterThan(100); // and we should have been reset back to admin - expect(client.setPowerLevel).toHaveBeenCalledWith(roomId, userId, 100, null); + expect(client.setPowerLevel).toHaveBeenCalledWith(roomId, userId, 100); }); it("sets up Element video rooms correctly", async () => { @@ -99,7 +99,7 @@ describe("createRoom", () => { // call should be immutable for admins expect(callPower).toBeGreaterThan(100); // and we should have been reset back to admin - expect(client.setPowerLevel).toHaveBeenCalledWith(roomId, userId, 100, null); + expect(client.setPowerLevel).toHaveBeenCalledWith(roomId, userId, 100); }); it("doesn't create calls in non-video-rooms", async () => { diff --git a/test/stores/room-list/previews/VoiceBroadcastPreview-test.ts b/test/stores/room-list/previews/VoiceBroadcastPreview-test.ts index ccffdeaa76d..86ab73aa8c4 100644 --- a/test/stores/room-list/previews/VoiceBroadcastPreview-test.ts +++ b/test/stores/room-list/previews/VoiceBroadcastPreview-test.ts @@ -14,9 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. */ +import { Room } from "matrix-js-sdk/src/matrix"; + import { VoiceBroadcastPreview } from "../../../../src/stores/room-list/previews/VoiceBroadcastPreview"; import { VoiceBroadcastInfoState } from "../../../../src/voice-broadcast"; -import { mkEvent } from "../../../test-utils"; +import { mkEvent, stubClient } from "../../../test-utils"; import { mkVoiceBroadcastInfoStateEvent } from "../../../voice-broadcast/utils/test-utils"; describe("VoiceBroadcastPreview.getTextFor", () => { @@ -51,7 +53,10 @@ describe("VoiceBroadcastPreview.getTextFor", () => { it("when passing a redacted broadcast stopped event, it should return null", () => { const event = mkVoiceBroadcastInfoStateEvent(roomId, VoiceBroadcastInfoState.Stopped, userId, deviceId); - event.makeRedacted(mkEvent({ event: true, content: {}, user: userId, type: "m.room.redaction" })); + event.makeRedacted( + mkEvent({ event: true, content: {}, user: userId, type: "m.room.redaction" }), + new Room(roomId, stubClient(), userId), + ); expect(preview.getTextFor(event)).toBeNull(); }); }); diff --git a/test/utils/EventUtils-test.ts b/test/utils/EventUtils-test.ts index fb88b7a21cf..dbfb7e9933b 100644 --- a/test/utils/EventUtils-test.ts +++ b/test/utils/EventUtils-test.ts @@ -73,7 +73,10 @@ describe("EventUtils", () => { type: EventType.RoomMessage, sender: userId, }); - redactedEvent.makeRedacted(redactedEvent); + redactedEvent.makeRedacted( + redactedEvent, + new Room(redactedEvent.getRoomId()!, mockClient, mockClient.getUserId()!), + ); const stateEvent = new MatrixEvent({ type: EventType.RoomTopic, diff --git a/test/utils/beacon/timeline-test.ts b/test/utils/beacon/timeline-test.ts index 716c5bf6b78..a5a4604e180 100644 --- a/test/utils/beacon/timeline-test.ts +++ b/test/utils/beacon/timeline-test.ts @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { EventType, MatrixEvent } from "matrix-js-sdk/src/matrix"; +import { EventType, MatrixEvent, Room } from "matrix-js-sdk/src/matrix"; import { shouldDisplayAsBeaconTile } from "../../../src/utils/beacon/timeline"; -import { makeBeaconInfoEvent } from "../../test-utils"; +import { makeBeaconInfoEvent, stubClient } from "../../test-utils"; describe("shouldDisplayAsBeaconTile", () => { const userId = "@user:server"; @@ -26,7 +26,7 @@ describe("shouldDisplayAsBeaconTile", () => { const notLiveBeacon = makeBeaconInfoEvent(userId, roomId, { isLive: false }); const memberEvent = new MatrixEvent({ type: EventType.RoomMember }); const redactedBeacon = makeBeaconInfoEvent(userId, roomId, { isLive: false }); - redactedBeacon.makeRedacted(redactedBeacon); + redactedBeacon.makeRedacted(redactedBeacon, new Room(roomId, stubClient(), userId)); it("returns true for a beacon with live property set to true", () => { expect(shouldDisplayAsBeaconTile(liveBeacon)).toBe(true); diff --git a/test/voice-broadcast/models/VoiceBroadcastPlayback-test.tsx b/test/voice-broadcast/models/VoiceBroadcastPlayback-test.tsx index 1c7e6b66c12..85f14fbfa2f 100644 --- a/test/voice-broadcast/models/VoiceBroadcastPlayback-test.tsx +++ b/test/voice-broadcast/models/VoiceBroadcastPlayback-test.tsx @@ -454,7 +454,7 @@ describe("VoiceBroadcastPlayback", () => { describe("and the info event is deleted", () => { beforeEach(() => { - infoEvent.makeRedacted(new MatrixEvent({})); + infoEvent.makeRedacted(new MatrixEvent({}), room); }); it("should stop and destroy the playback", () => {