Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions cypress/e2e/room-directory/room-directory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,32 +72,4 @@ describe("Room Directory", () => {
expect(resp.chunk[0].room_id).to.equal(roomId);
});
});

it("should allow finding published rooms in directory", () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this case covered in the spotlight tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finding public rooms is in spotlight's tests.

But sure, I could add a test that creates a private room, publishes it via the UI, and then tries to find it, just for completeness' sake.

const name = "This is a public room";
cy.all([
cy.window({ log: false }),
cy.get<MatrixClient>("@bot"),
]).then(([win, bot]) => {
bot.createRoom({
visibility: win.matrixcs.Visibility.Public,
name,
room_alias_name: "test1234",
});
});

cy.get('[role="button"][aria-label="Explore rooms"]').click();

cy.get('.mx_RoomDirectory_dialogWrapper [name="dirsearch"]').type("Unknown Room");
cy.get(".mx_RoomDirectory_dialogWrapper h5").should("contain", 'No results for "Unknown Room"');
cy.get(".mx_RoomDirectory_dialogWrapper").percySnapshotElement("Room Directory - filtered no results");

cy.get('.mx_RoomDirectory_dialogWrapper [name="dirsearch"]').type("{selectAll}{backspace}test1234");
cy.contains(".mx_RoomDirectory_dialogWrapper .mx_RoomDirectory_listItem", name)
.should("exist").as("resultRow");
cy.get(".mx_RoomDirectory_dialogWrapper").percySnapshotElement("Room Directory - filtered one result");
cy.get("@resultRow").find(".mx_AccessibleButton").contains("Join").click();

cy.url().should('contain', `/#/room/#test1234:localhost`);
});
});
7 changes: 6 additions & 1 deletion src/components/structures/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import MatrixClientContext from "../../contexts/MatrixClientContext";
import MiniAvatarUploader, { AVATAR_SIZE } from "../views/elements/MiniAvatarUploader";
import PosthogTrackers from "../../PosthogTrackers";
import EmbeddedPage from "./EmbeddedPage";
import { OpenSpotlightPayload } from "../../dispatcher/payloads/OpenSpotlightPayload";
import { Filter } from "../views/dialogs/spotlight/SpotlightDialog";

const onClickSendDm = (ev: ButtonEvent) => {
PosthogTrackers.trackInteraction("WebHomeCreateChatButton", ev);
Expand All @@ -40,7 +42,10 @@ const onClickSendDm = (ev: ButtonEvent) => {

const onClickExplore = (ev: ButtonEvent) => {
PosthogTrackers.trackInteraction("WebHomeExploreRoomsButton", ev);
dis.fire(Action.ViewRoomDirectory);
dis.dispatch<OpenSpotlightPayload>({
action: Action.OpenSpotlight,
initialFilter: Filter.PublicRooms,
});
};

const onClickNewRoom = (ev: ButtonEvent) => {
Expand Down
9 changes: 7 additions & 2 deletions src/components/structures/LeftPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2020 The Matrix.org Foundation C.I.C.
Copyright 2020, 2022 The Matrix.org Foundation C.I.C.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -19,7 +19,9 @@ import { createRef } from "react";
import classNames from "classnames";

import dis from "../../dispatcher/dispatcher";
import { OpenSpotlightPayload } from "../../dispatcher/payloads/OpenSpotlightPayload";
import { _t } from "../../languageHandler";
import { Filter } from "../views/dialogs/spotlight/SpotlightDialog";
import RoomList from "../views/rooms/RoomList";
import LegacyCallHandler from "../../LegacyCallHandler";
import { HEADER_HEIGHT } from "../views/rooms/RoomSublist";
Expand Down Expand Up @@ -121,8 +123,11 @@ export default class LeftPanel extends React.Component<IProps, IState> {
};

private onExplore = (ev: ButtonEvent) => {
dis.fire(Action.ViewRoomDirectory);
PosthogTrackers.trackInteraction("WebLeftPanelExploreRoomsButton", ev);
dis.dispatch<OpenSpotlightPayload>({
action: Action.OpenSpotlight,
initialFilter: Filter.PublicRooms,
});
};

private refreshStickyHeaders = () => {
Expand Down
15 changes: 10 additions & 5 deletions src/components/structures/MatrixChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ import Spinner from "../views/elements/Spinner";
import QuestionDialog from "../views/dialogs/QuestionDialog";
import UserSettingsDialog from '../views/dialogs/UserSettingsDialog';
import CreateRoomDialog from '../views/dialogs/CreateRoomDialog';
import RoomDirectory from './RoomDirectory';
import KeySignatureUploadFailedDialog from "../views/dialogs/KeySignatureUploadFailedDialog";
import IncomingSasDialog from "../views/dialogs/IncomingSasDialog";
import CompleteSecurity from "./auth/CompleteSecurity";
Expand Down Expand Up @@ -135,6 +134,8 @@ import { RightPanelPhases } from "../../stores/right-panel/RightPanelStorePhases
import RightPanelStore from "../../stores/right-panel/RightPanelStore";
import { TimelineRenderingType } from "../../contexts/RoomContext";
import { UseCaseSelection } from '../views/elements/UseCaseSelection';
import SpotlightDialog, { Filter } from '../views/dialogs/spotlight/SpotlightDialog';
import { OpenSpotlightPayload } from '../../dispatcher/payloads/OpenSpotlightPayload';
import { ValidatedServerConfig } from '../../utils/ValidatedServerConfig';
import { isLocalRoom } from '../../utils/localRoom/isLocalRoom';
import { SdkContextClass, SDKContext } from '../../contexts/SDKContext';
Expand Down Expand Up @@ -708,10 +709,11 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
// View the welcome or home page if we need something to look at
this.viewSomethingBehindModal();
break;
case Action.ViewRoomDirectory: {
Modal.createDialog(RoomDirectory, {
case Action.OpenSpotlight: {
Modal.createDialog(SpotlightDialog, {
initialText: payload.initialText,
}, 'mx_RoomDirectory_dialogWrapper', false, true);
initialFilter: payload.initialFilter,
}, "mx_SpotlightDialog_wrapper", false, true);

// View the welcome or home page if we need something to look at
this.viewSomethingBehindModal();
Expand Down Expand Up @@ -1711,7 +1713,10 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
action: 'require_registration',
});
} else if (screen === 'directory') {
dis.fire(Action.ViewRoomDirectory);
dis.dispatch<OpenSpotlightPayload>({
action: Action.OpenSpotlight,
initialFilter: Filter.PublicRooms,
});
} else if (screen === "start_sso" || screen === "start_cas") {
let cli = MatrixClientPeg.get();
if (!cli) {
Expand Down
Loading