Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/28387/head
Michael Telatynski 2024-11-05 19:12:43 +00:00
parent 21930a10ae
commit f3e976d67d
No known key found for this signature in database
GPG Key ID: A2B008A5F49F5D0D
9 changed files with 57 additions and 47 deletions

View File

@ -40,6 +40,8 @@ export default {
"util", "util",
// Used by workflows // Used by workflows
"ts-prune", "ts-prune",
// Required due to bug in bloom-filters https://github.com/Callidon/bloom-filters/issues/75
"@types/seedrandom",
], ],
ignoreBinaries: [ ignoreBinaries: [
// Used in scripts & workflows // Used in scripts & workflows

View File

@ -92,7 +92,7 @@
"@zxcvbn-ts/language-common": "^3.0.4", "@zxcvbn-ts/language-common": "^3.0.4",
"@zxcvbn-ts/language-en": "^3.0.2", "@zxcvbn-ts/language-en": "^3.0.2",
"await-lock": "^2.1.0", "await-lock": "^2.1.0",
"bloom-filters": "^3.0.1", "bloom-filters": "^3.0.2",
"blurhash": "^2.0.3", "blurhash": "^2.0.3",
"browserslist": "^4.23.2", "browserslist": "^4.23.2",
"classnames": "^2.2.6", "classnames": "^2.2.6",
@ -203,6 +203,7 @@
"@types/react-dom": "18.3.1", "@types/react-dom": "18.3.1",
"@types/react-transition-group": "^4.4.0", "@types/react-transition-group": "^4.4.0",
"@types/sanitize-html": "2.13.0", "@types/sanitize-html": "2.13.0",
"@types/seedrandom": "3.0.8",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"@types/tar-js": "^0.3.5", "@types/tar-js": "^0.3.5",
"@types/ua-parser-js": "^0.7.36", "@types/ua-parser-js": "^0.7.36",

View File

@ -14,7 +14,7 @@ import { IDeferred, defer } from "matrix-js-sdk/src/utils";
import { TypedEventEmitter } from "matrix-js-sdk/src/matrix"; import { TypedEventEmitter } from "matrix-js-sdk/src/matrix";
import { Glass, TooltipProvider } from "@vector-im/compound-web"; import { Glass, TooltipProvider } from "@vector-im/compound-web";
import dis, { defaultDispatcher } from "./dispatcher/dispatcher"; import defaultDispatcher from "./dispatcher/dispatcher";
import AsyncWrapper from "./AsyncWrapper"; import AsyncWrapper from "./AsyncWrapper";
import { Defaultize } from "./@types/common"; import { Defaultize } from "./@types/common";
import { ActionPayload } from "./dispatcher/payloads"; import { ActionPayload } from "./dispatcher/payloads";
@ -396,7 +396,7 @@ export class ModalManager extends TypedEventEmitter<ModalManagerEvent, HandlerMa
if (this.modals.length === 0 && !this.priorityModal && !this.staticModal) { if (this.modals.length === 0 && !this.priorityModal && !this.staticModal) {
// If there is no modal to render, make all of Element available // If there is no modal to render, make all of Element available
// to screen reader users again // to screen reader users again
dis.dispatch({ defaultDispatcher.dispatch({
action: "aria_unhide_main_app", action: "aria_unhide_main_app",
}); });
ModalManager.getOrCreateRoot().render(<></>); ModalManager.getOrCreateRoot().render(<></>);
@ -407,7 +407,7 @@ export class ModalManager extends TypedEventEmitter<ModalManagerEvent, HandlerMa
// Hide the content outside the modal to screen reader users // Hide the content outside the modal to screen reader users
// so they won't be able to navigate into it and act on it using // so they won't be able to navigate into it and act on it using
// screen reader specific features // screen reader specific features
dis.dispatch({ defaultDispatcher.dispatch({
action: "aria_hide_main_app", action: "aria_hide_main_app",
}); });

View File

@ -45,7 +45,7 @@ import ResizeNotifier from "../../utils/ResizeNotifier";
import ContentMessages from "../../ContentMessages"; import ContentMessages from "../../ContentMessages";
import Modal from "../../Modal"; import Modal from "../../Modal";
import { LegacyCallHandlerEvent } from "../../LegacyCallHandler"; import { LegacyCallHandlerEvent } from "../../LegacyCallHandler";
import dis, { defaultDispatcher } from "../../dispatcher/dispatcher"; import defaultDispatcher from "../../dispatcher/dispatcher";
import * as Rooms from "../../Rooms"; import * as Rooms from "../../Rooms";
import MainSplit from "./MainSplit"; import MainSplit from "./MainSplit";
import RightPanel from "./RightPanel"; import RightPanel from "./RightPanel";
@ -437,7 +437,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
private onWidgetLayoutChange = (): void => { private onWidgetLayoutChange = (): void => {
if (!this.state.room) return; if (!this.state.room) return;
dis.dispatch({ defaultDispatcher.dispatch({
action: "appsDrawer", action: "appsDrawer",
show: true, show: true,
}); });
@ -598,7 +598,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
// Handle the use case of a link to a thread message // Handle the use case of a link to a thread message
// ie: #/room/roomId/eventId (eventId of a thread message) // ie: #/room/roomId/eventId (eventId of a thread message)
if (thread?.rootEvent && !initialEvent?.isThreadRoot) { if (thread?.rootEvent && !initialEvent?.isThreadRoot) {
dis.dispatch<ShowThreadPayload>({ defaultDispatcher.dispatch<ShowThreadPayload>({
action: Action.ShowThread, action: Action.ShowThread,
rootEvent: thread.rootEvent, rootEvent: thread.rootEvent,
initialEvent, initialEvent,
@ -704,7 +704,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
const activeCall = CallStore.instance.getActiveCall(this.state.roomId); const activeCall = CallStore.instance.getActiveCall(this.state.roomId);
if (activeCall === null) { if (activeCall === null) {
// We disconnected from the call, so stop viewing it // We disconnected from the call, so stop viewing it
dis.dispatch<ViewRoomPayload>( defaultDispatcher.dispatch<ViewRoomPayload>(
{ {
action: Action.ViewRoom, action: Action.ViewRoom,
room_id: this.state.roomId, room_id: this.state.roomId,
@ -850,7 +850,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
public componentDidMount(): void { public componentDidMount(): void {
this.unmounted = false; this.unmounted = false;
this.dispatcherRef = dis.register(this.onAction); this.dispatcherRef = defaultDispatcher.register(this.onAction);
if (this.context.client) { if (this.context.client) {
this.context.client.on(ClientEvent.Room, this.onRoom); this.context.client.on(ClientEvent.Room, this.onRoom);
this.context.client.on(RoomEvent.Timeline, this.onRoomTimeline); this.context.client.on(RoomEvent.Timeline, this.onRoomTimeline);
@ -967,7 +967,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
// stop tracking room changes to format permalinks // stop tracking room changes to format permalinks
this.stopAllPermalinkCreators(); this.stopAllPermalinkCreators();
dis.unregister(this.dispatcherRef); defaultDispatcher.unregister(this.dispatcherRef);
if (this.context.client) { if (this.context.client) {
this.context.client.removeListener(ClientEvent.Room, this.onRoom); this.context.client.removeListener(ClientEvent.Room, this.onRoom);
this.context.client.removeListener(RoomEvent.Timeline, this.onRoomTimeline); this.context.client.removeListener(RoomEvent.Timeline, this.onRoomTimeline);
@ -1045,7 +1045,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
handled = true; handled = true;
break; break;
case KeyBindingAction.UploadFile: { case KeyBindingAction.UploadFile: {
dis.dispatch( defaultDispatcher.dispatch(
{ {
action: "upload_file", action: "upload_file",
context: TimelineRenderingType.Room, context: TimelineRenderingType.Room,
@ -1145,7 +1145,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
if (payload.event && payload.event.getRoomId() !== this.state.roomId) { if (payload.event && payload.event.getRoomId() !== this.state.roomId) {
// If the event is in a different room (e.g. because the event to be edited is being displayed // If the event is in a different room (e.g. because the event to be edited is being displayed
// in the results of an all-rooms search), we need to view that room first. // in the results of an all-rooms search), we need to view that room first.
dis.dispatch<ViewRoomPayload>({ defaultDispatcher.dispatch<ViewRoomPayload>({
action: Action.ViewRoom, action: Action.ViewRoom,
room_id: payload.event.getRoomId(), room_id: payload.event.getRoomId(),
metricsTrigger: undefined, metricsTrigger: undefined,
@ -1188,7 +1188,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
} }
// re-dispatch to the correct composer // re-dispatch to the correct composer
dis.dispatch<ComposerInsertPayload>({ defaultDispatcher.dispatch<ComposerInsertPayload>({
...(payload as ComposerInsertPayload), ...(payload as ComposerInsertPayload),
timelineRenderingType, timelineRenderingType,
composerType: this.state.editState ? ComposerType.Edit : ComposerType.Send, composerType: this.state.editState ? ComposerType.Edit : ComposerType.Send,
@ -1197,7 +1197,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
} }
case Action.FocusAComposer: { case Action.FocusAComposer: {
dis.dispatch<FocusComposerPayload>({ defaultDispatcher.dispatch<FocusComposerPayload>({
...(payload as FocusComposerPayload), ...(payload as FocusComposerPayload),
// re-dispatch to the correct composer (the send message will still be on screen even when editing a message) // re-dispatch to the correct composer (the send message will still be on screen even when editing a message)
action: this.state.editState ? Action.FocusEditMessageComposer : Action.FocusSendMessageComposer, action: this.state.editState ? Action.FocusEditMessageComposer : Action.FocusSendMessageComposer,
@ -1303,7 +1303,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
if (containsEmoji(ev.getContent(), effect.emojis) || ev.getContent().msgtype === effect.msgType) { if (containsEmoji(ev.getContent(), effect.emojis) || ev.getContent().msgtype === effect.msgType) {
// For initial threads launch, chat effects are disabled see #19731 // For initial threads launch, chat effects are disabled see #19731
if (!ev.isRelation(THREAD_RELATION_TYPE.name)) { if (!ev.isRelation(THREAD_RELATION_TYPE.name)) {
dis.dispatch({ action: `effects.${effect.command}`, event: ev }); defaultDispatcher.dispatch({ action: `effects.${effect.command}`, event: ev });
} }
} }
}); });
@ -1363,7 +1363,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
liveTimeline: room.getLiveTimeline(), liveTimeline: room.getLiveTimeline(),
}); });
dis.dispatch<ActionPayload>({ action: Action.RoomLoaded }); defaultDispatcher.dispatch<ActionPayload>({ action: Action.RoomLoaded });
}; };
private onRoomTimelineReset = (room?: Room): void => { private onRoomTimelineReset = (room?: Room): void => {
@ -1561,7 +1561,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
private onInviteClick = (): void => { private onInviteClick = (): void => {
// open the room inviter // open the room inviter
dis.dispatch({ defaultDispatcher.dispatch({
action: "view_invite", action: "view_invite",
roomId: this.getRoomId(), roomId: this.getRoomId(),
}); });
@ -1572,7 +1572,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
if (this.context.client?.isGuest()) { if (this.context.client?.isGuest()) {
// Join this room once the user has registered and logged in // Join this room once the user has registered and logged in
// (If we failed to peek, we may not have a valid room object.) // (If we failed to peek, we may not have a valid room object.)
dis.dispatch<DoAfterSyncPreparedPayload<ViewRoomPayload>>({ defaultDispatcher.dispatch<DoAfterSyncPreparedPayload<ViewRoomPayload>>({
action: Action.DoAfterSyncPrepared, action: Action.DoAfterSyncPrepared,
deferred_action: { deferred_action: {
action: Action.ViewRoom, action: Action.ViewRoom,
@ -1580,13 +1580,13 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
metricsTrigger: undefined, metricsTrigger: undefined,
}, },
}); });
dis.dispatch({ action: "require_registration" }); defaultDispatcher.dispatch({ action: "require_registration" });
} else { } else {
Promise.resolve().then(() => { Promise.resolve().then(() => {
const signUrl = this.props.threepidInvite?.signUrl; const signUrl = this.props.threepidInvite?.signUrl;
const roomId = this.getRoomId(); const roomId = this.getRoomId();
if (isNotUndefined(roomId)) { if (isNotUndefined(roomId)) {
dis.dispatch<JoinRoomPayload>({ defaultDispatcher.dispatch<JoinRoomPayload>({
action: Action.JoinRoom, action: Action.JoinRoom,
roomId, roomId,
opts: { inviteSignUrl: signUrl }, opts: { inviteSignUrl: signUrl },
@ -1622,7 +1622,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
this.state.initialEventId === eventId this.state.initialEventId === eventId
) { ) {
debuglog("Removing scroll_into_view flag from initial event"); debuglog("Removing scroll_into_view flag from initial event");
dis.dispatch<ViewRoomPayload>({ defaultDispatcher.dispatch<ViewRoomPayload>({
action: Action.ViewRoom, action: Action.ViewRoom,
room_id: this.getRoomId(), room_id: this.getRoomId(),
event_id: this.state.initialEventId, event_id: this.state.initialEventId,
@ -1638,7 +1638,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
const roomId = this.getRoomId(); const roomId = this.getRoomId();
if (!this.context.client || !roomId) return; if (!this.context.client || !roomId) return;
if (this.context.client.isGuest()) { if (this.context.client.isGuest()) {
dis.dispatch({ action: "require_registration" }); defaultDispatcher.dispatch({ action: "require_registration" });
return; return;
} }
@ -1688,7 +1688,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
}; };
private onForgetClick = (): void => { private onForgetClick = (): void => {
dis.dispatch({ defaultDispatcher.dispatch({
action: "forget_room", action: "forget_room",
room_id: this.getRoomId(), room_id: this.getRoomId(),
}); });
@ -1702,7 +1702,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
}); });
this.context.client?.leave(roomId).then( this.context.client?.leave(roomId).then(
() => { () => {
dis.dispatch({ action: Action.ViewHomePage }); defaultDispatcher.dispatch({ action: Action.ViewHomePage });
this.setState({ this.setState({
rejecting: false, rejecting: false,
}); });
@ -1736,7 +1736,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
await this.context.client!.setIgnoredUsers(ignoredUsers); await this.context.client!.setIgnoredUsers(ignoredUsers);
await this.context.client!.leave(this.state.roomId!); await this.context.client!.leave(this.state.roomId!);
dis.dispatch({ action: Action.ViewHomePage }); defaultDispatcher.dispatch({ action: Action.ViewHomePage });
this.setState({ this.setState({
rejecting: false, rejecting: false,
}); });
@ -1760,7 +1760,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
// using /leave rather than /join. In the short term though, we // using /leave rather than /join. In the short term though, we
// just ignore them. // just ignore them.
// https://github.com/vector-im/vector-web/issues/1134 // https://github.com/vector-im/vector-web/issues/1134
dis.fire(Action.ViewRoomDirectory); defaultDispatcher.fire(Action.ViewRoomDirectory);
}; };
private onSearchChange = debounce((e: ChangeEvent): void => { private onSearchChange = debounce((e: ChangeEvent): void => {
@ -1786,7 +1786,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
// If we were viewing a highlighted event, firing view_room without // If we were viewing a highlighted event, firing view_room without
// an event will take care of both clearing the URL fragment and // an event will take care of both clearing the URL fragment and
// jumping to the bottom // jumping to the bottom
dis.dispatch<ViewRoomPayload>({ defaultDispatcher.dispatch<ViewRoomPayload>({
action: Action.ViewRoom, action: Action.ViewRoom,
room_id: this.getRoomId(), room_id: this.getRoomId(),
metricsTrigger: undefined, // room doesn't change metricsTrigger: undefined, // room doesn't change
@ -1794,7 +1794,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
} else { } else {
// Otherwise we have to jump manually // Otherwise we have to jump manually
this.messagePanel?.jumpToLiveTimeline(); this.messagePanel?.jumpToLiveTimeline();
dis.fire(Action.FocusSendMessageComposer); defaultDispatcher.fire(Action.FocusSendMessageComposer);
} }
}; };
@ -1918,7 +1918,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
public onHiddenHighlightsClick = (): void => { public onHiddenHighlightsClick = (): void => {
const oldRoom = this.getOldRoom(); const oldRoom = this.getOldRoom();
if (!oldRoom) return; if (!oldRoom) return;
dis.dispatch<ViewRoomPayload>({ defaultDispatcher.dispatch<ViewRoomPayload>({
action: Action.ViewRoom, action: Action.ViewRoom,
room_id: oldRoom.roomId, room_id: oldRoom.roomId,
metricsTrigger: "Predecessor", metricsTrigger: "Predecessor",
@ -2001,7 +2001,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
const roomId = this.getRoomId(); const roomId = this.getRoomId();
if (isNotUndefined(roomId)) { if (isNotUndefined(roomId)) {
dis.dispatch<SubmitAskToJoinPayload>({ defaultDispatcher.dispatch<SubmitAskToJoinPayload>({
action: Action.SubmitAskToJoin, action: Action.SubmitAskToJoin,
roomId, roomId,
opts: { reason }, opts: { reason },
@ -2018,7 +2018,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
const roomId = this.getRoomId(); const roomId = this.getRoomId();
if (isNotUndefined(roomId)) { if (isNotUndefined(roomId)) {
dis.dispatch<CancelAskToJoinPayload>({ defaultDispatcher.dispatch<CancelAskToJoinPayload>({
action: Action.CancelAskToJoin, action: Action.CancelAskToJoin,
roomId, roomId,
}); });

View File

@ -12,7 +12,7 @@ import { logger } from "matrix-js-sdk/src/logger";
import { _t } from "../../../languageHandler"; import { _t } from "../../../languageHandler";
import AccessibleButton, { ButtonEvent } from "../elements/AccessibleButton"; import AccessibleButton, { ButtonEvent } from "../elements/AccessibleButton";
import dispatcher, { defaultDispatcher } from "../../../dispatcher/dispatcher"; import defaultDispatcher from "../../../dispatcher/dispatcher";
import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload"; import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload";
import { Action } from "../../../dispatcher/actions"; import { Action } from "../../../dispatcher/actions";
import { ConnectionState, ElementCall } from "../../../models/Call"; import { ConnectionState, ElementCall } from "../../../models/Call";
@ -53,7 +53,7 @@ const RoomCallBannerInner: React.FC<RoomCallBannerProps> = ({ roomId, call }) =>
return; return;
} }
dispatcher.dispatch<ViewRoomPayload>({ defaultDispatcher.dispatch<ViewRoomPayload>({
action: Action.ViewRoom, action: Action.ViewRoom,
room_id: roomId, room_id: roomId,
metricsTrigger: undefined, metricsTrigger: undefined,

View File

@ -37,7 +37,7 @@ import { Icon as ExpandMessageIcon } from "../../../../res/img/element-icons/exp
import { Icon as CollapseMessageIcon } from "../../../../res/img/element-icons/collapse-message.svg"; import { Icon as CollapseMessageIcon } from "../../../../res/img/element-icons/collapse-message.svg";
import type { Relations } from "matrix-js-sdk/src/matrix"; import type { Relations } from "matrix-js-sdk/src/matrix";
import { _t } from "../../../languageHandler"; import { _t } from "../../../languageHandler";
import dis, { defaultDispatcher } from "../../../dispatcher/dispatcher"; import defaultDispatcher from "../../../dispatcher/dispatcher";
import ContextMenu, { aboveLeftOf, ContextMenuTooltipButton, useContextMenu } from "../../structures/ContextMenu"; import ContextMenu, { aboveLeftOf, ContextMenuTooltipButton, useContextMenu } from "../../structures/ContextMenu";
import { isContentActionable, canEditContent, editEvent, canCancel } from "../../../utils/EventUtils"; import { isContentActionable, canEditContent, editEvent, canCancel } from "../../../utils/EventUtils";
import RoomContext, { TimelineRenderingType } from "../../../contexts/RoomContext"; import RoomContext, { TimelineRenderingType } from "../../../contexts/RoomContext";
@ -323,7 +323,7 @@ export default class MessageActionBar extends React.PureComponent<IMessageAction
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
dis.dispatch({ defaultDispatcher.dispatch({
action: "reply_to_event", action: "reply_to_event",
event: this.props.mxEvent, event: this.props.mxEvent,
context: this.context.timelineRenderingType, context: this.context.timelineRenderingType,

View File

@ -42,7 +42,7 @@ import {
} from "../../../test-utils"; } from "../../../test-utils";
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg"; import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
import { Action } from "../../../../src/dispatcher/actions"; import { Action } from "../../../../src/dispatcher/actions";
import dis, { defaultDispatcher } from "../../../../src/dispatcher/dispatcher"; import defaultDispatcher from "../../../../src/dispatcher/dispatcher";
import { ViewRoomPayload } from "../../../../src/dispatcher/payloads/ViewRoomPayload"; import { ViewRoomPayload } from "../../../../src/dispatcher/payloads/ViewRoomPayload";
import { RoomView as _RoomView } from "../../../../src/components/structures/RoomView"; import { RoomView as _RoomView } from "../../../../src/components/structures/RoomView";
import ResizeNotifier from "../../../../src/utils/ResizeNotifier"; import ResizeNotifier from "../../../../src/utils/ResizeNotifier";
@ -527,7 +527,7 @@ describe("RoomView", () => {
beforeEach(() => { beforeEach(() => {
jest.spyOn(SettingsStore, "getValue").mockImplementation((setting) => setting === "feature_ask_to_join"); jest.spyOn(SettingsStore, "getValue").mockImplementation((setting) => setting === "feature_ask_to_join");
jest.spyOn(room, "getJoinRule").mockReturnValue(JoinRule.Knock); jest.spyOn(room, "getJoinRule").mockReturnValue(JoinRule.Knock);
jest.spyOn(dis, "dispatch"); jest.spyOn(defaultDispatcher, "dispatch");
}); });
it("allows to request to join", async () => { it("allows to request to join", async () => {
@ -536,9 +536,9 @@ describe("RoomView", () => {
await mountRoomView(); await mountRoomView();
fireEvent.click(screen.getByRole("button", { name: "Request access" })); fireEvent.click(screen.getByRole("button", { name: "Request access" }));
await untilDispatch(Action.SubmitAskToJoin, dis); await untilDispatch(Action.SubmitAskToJoin, defaultDispatcher);
expect(dis.dispatch).toHaveBeenCalledWith({ expect(defaultDispatcher.dispatch).toHaveBeenCalledWith({
action: "submit_ask_to_join", action: "submit_ask_to_join",
roomId: room.roomId, roomId: room.roomId,
opts: { reason: undefined }, opts: { reason: undefined },
@ -552,9 +552,12 @@ describe("RoomView", () => {
await mountRoomView(); await mountRoomView();
fireEvent.click(screen.getByRole("button", { name: "Cancel request" })); fireEvent.click(screen.getByRole("button", { name: "Cancel request" }));
await untilDispatch(Action.CancelAskToJoin, dis); await untilDispatch(Action.CancelAskToJoin, defaultDispatcher);
expect(dis.dispatch).toHaveBeenCalledWith({ action: "cancel_ask_to_join", roomId: room.roomId }); expect(defaultDispatcher.dispatch).toHaveBeenCalledWith({
action: "cancel_ask_to_join",
roomId: room.roomId,
});
}); });
}); });
@ -669,7 +672,7 @@ describe("RoomView", () => {
await waitFor(() => { await waitFor(() => {
expect(container.querySelector(".mx_RoomView_searchResultsPanel")).toBeVisible(); expect(container.querySelector(".mx_RoomView_searchResultsPanel")).toBeVisible();
}); });
const prom = untilDispatch(Action.ViewRoom, dis); const prom = untilDispatch(Action.ViewRoom, defaultDispatcher);
await userEvent.hover(getByText("search term")); await userEvent.hover(getByText("search term"));
await userEvent.click(await findByLabelText("Edit")); await userEvent.click(await findByLabelText("Edit"));
@ -678,8 +681,8 @@ describe("RoomView", () => {
}); });
it("fires Action.RoomLoaded", async () => { it("fires Action.RoomLoaded", async () => {
jest.spyOn(dis, "dispatch"); jest.spyOn(defaultDispatcher, "dispatch");
await mountRoomView(); await mountRoomView();
expect(dis.dispatch).toHaveBeenCalledWith({ action: Action.RoomLoaded }); expect(defaultDispatcher.dispatch).toHaveBeenCalledWith({ action: Action.RoomLoaded });
}); });
}); });

View File

@ -12,7 +12,6 @@ import { ClientWidgetApi, IWidget, MatrixWidgetType } from "matrix-widget-api";
import { Optional } from "matrix-events-sdk"; import { Optional } from "matrix-events-sdk";
import { act, render, RenderResult } from "jest-matrix-react"; import { act, render, RenderResult } from "jest-matrix-react";
import userEvent from "@testing-library/user-event"; import userEvent from "@testing-library/user-event";
import { SpiedFunction } from "jest-mock";
import { import {
ApprovalOpts, ApprovalOpts,
WidgetInfo, WidgetInfo,
@ -344,7 +343,7 @@ describe("AppTile", () => {
describe("for a pinned widget", () => { describe("for a pinned widget", () => {
let renderResult: RenderResult; let renderResult: RenderResult;
let moveToContainerSpy: SpiedFunction<typeof WidgetLayoutStore.instance.moveToContainer>; let moveToContainerSpy: jest.SpyInstance<void, [room: Room, widget: IWidget, toContainer: Container]>;
beforeEach(() => { beforeEach(() => {
renderResult = render( renderResult = render(

View File

@ -3080,6 +3080,11 @@
dependencies: dependencies:
htmlparser2 "^8.0.0" htmlparser2 "^8.0.0"
"@types/seedrandom@3.0.8":
version "3.0.8"
resolved "https://registry.yarnpkg.com/@types/seedrandom/-/seedrandom-3.0.8.tgz#61cc8ed88f93a3c31289c295e6df8ca40be42bdf"
integrity sha512-TY1eezMU2zH2ozQoAFAQFOPpvP15g+ZgSfTZt31AUUH/Rxtnz3H+A/Sv1Snw2/amp//omibc+AEkTaA8KUeOLQ==
"@types/semver@^7.5.8": "@types/semver@^7.5.8":
version "7.5.8" version "7.5.8"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e"
@ -4035,7 +4040,7 @@ blob-polyfill@^9.0.0:
resolved "https://registry.yarnpkg.com/blob-polyfill/-/blob-polyfill-9.0.20240710.tgz#2ef075a207311ea327704f04dc4a98cbefe4143b" resolved "https://registry.yarnpkg.com/blob-polyfill/-/blob-polyfill-9.0.20240710.tgz#2ef075a207311ea327704f04dc4a98cbefe4143b"
integrity sha512-DPUO/EjNANCgSVg0geTy1vmUpu5hhp9tV2F7xUSTUd1jwe4XpwupGB+lt5PhVUqpqAk+zK1etqp6Pl/HVf71Ug== integrity sha512-DPUO/EjNANCgSVg0geTy1vmUpu5hhp9tV2F7xUSTUd1jwe4XpwupGB+lt5PhVUqpqAk+zK1etqp6Pl/HVf71Ug==
bloom-filters@^3.0.1: bloom-filters@^3.0.2:
version "3.0.2" version "3.0.2"
resolved "https://registry.yarnpkg.com/bloom-filters/-/bloom-filters-3.0.2.tgz#9c386fca1913da554ededf7a7163bbb93a82d1dd" resolved "https://registry.yarnpkg.com/bloom-filters/-/bloom-filters-3.0.2.tgz#9c386fca1913da554ededf7a7163bbb93a82d1dd"
integrity sha512-QPKiokjBy16SrBh8T/FAWo74VuNwACnJ9t+q15a+9w5CDaOqHTPPBrDUy70U7YE4+DmENRodtlEdeeq1pB4DZQ== integrity sha512-QPKiokjBy16SrBh8T/FAWo74VuNwACnJ9t+q15a+9w5CDaOqHTPPBrDUy70U7YE4+DmENRodtlEdeeq1pB4DZQ==