Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Consolidate public room search experience #9605

Merged
merged 15 commits into from
Nov 22, 2022
Next Next commit
Consolidate public room search experience
germain-gg committed Nov 21, 2022
commit 9d13133d09a8b86e4a93b01bf725abacba4d84df
15 changes: 8 additions & 7 deletions cypress/e2e/room-directory/room-directory.spec.ts
Original file line number Diff line number Diff line change
@@ -88,15 +88,16 @@ describe("Room Directory", () => {

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_SpotlightDialog [aria-label="Search"]').type("Unknown Room");
cy.get(".mx_SpotlightDialog .mx_SpotlightDialog_otherSearches_messageSearchText")
.should("contain", "can't find the room you're looking for");
cy.get(".mx_SpotlightDialog").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)
cy.get('.mx_SpotlightDialog [aria-label="Search"]').type("{selectAll}{backspace}test1234");
cy.contains(".mx_SpotlightDialog .mx_SpotlightDialog_result_publicRoomName", name)
.should("exist").as("resultRow");
germain-gg marked this conversation as resolved.
Show resolved Hide resolved
cy.get(".mx_RoomDirectory_dialogWrapper").percySnapshotElement("Room Directory - filtered one result");
cy.get("@resultRow").find(".mx_AccessibleButton").contains("Join").click();
cy.get(".mx_SpotlightDialog").percySnapshotElement("Room Directory - filtered one result");
cy.get(".mx_SpotlightDialog .mx_SpotlightDialog_option").find(".mx_AccessibleButton").contains("Join").click();

cy.url().should('contain', `/#/room/#test1234:localhost`);
});
2 changes: 0 additions & 2 deletions res/css/_components.pcss
Original file line number Diff line number Diff line change
@@ -63,7 +63,6 @@
@import "./structures/_NotificationPanel.pcss";
@import "./structures/_QuickSettingsButton.pcss";
@import "./structures/_RightPanel.pcss";
@import "./structures/_RoomDirectory.pcss";
@import "./structures/_RoomSearch.pcss";
@import "./structures/_RoomStatusBar.pcss";
@import "./structures/_RoomView.pcss";
@@ -169,7 +168,6 @@
@import "./views/elements/_CopyableText.pcss";
@import "./views/elements/_DesktopCapturerSourcePicker.pcss";
@import "./views/elements/_DialPadBackspaceButton.pcss";
@import "./views/elements/_DirectorySearchBox.pcss";
@import "./views/elements/_Dropdown.pcss";
@import "./views/elements/_EditableItemList.pcss";
@import "./views/elements/_ErrorBoundary.pcss";
220 changes: 0 additions & 220 deletions res/css/structures/_RoomDirectory.pcss

This file was deleted.

49 changes: 0 additions & 49 deletions res/css/views/elements/_DirectorySearchBox.pcss

This file was deleted.

7 changes: 4 additions & 3 deletions src/components/structures/MatrixChat.tsx
Original file line number Diff line number Diff line change
@@ -95,7 +95,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";
@@ -141,6 +140,7 @@ import { viewUserDeviceSettings } from '../../actions/handlers/viewUserDeviceSet
import { VoiceBroadcastResumer } from '../../voice-broadcast';
import GenericToast from "../views/toasts/GenericToast";
import { Linkify } from "../views/elements/Linkify";
import RovingSpotlightDialog, { Filter } from '../views/dialogs/spotlight/SpotlightDialog';

// legacy export
export { default as Views } from "../../Views";
@@ -716,9 +716,10 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
this.viewSomethingBehindModal();
break;
case Action.ViewRoomDirectory: {
Modal.createDialog(RoomDirectory, {
Modal.createDialog(RovingSpotlightDialog, {
initialText: payload.initialText,
}, 'mx_RoomDirectory_dialogWrapper', false, true);
initialFilter: Filter.PublicRooms,
}, 'mx_SpotlightDialog_wrapper', false, true);

// View the welcome or home page if we need something to look at
this.viewSomethingBehindModal();
560 changes: 0 additions & 560 deletions src/components/structures/RoomDirectory.tsx

This file was deleted.

5 changes: 3 additions & 2 deletions src/components/structures/SpaceHierarchy.tsx
Original file line number Diff line number Diff line change
@@ -55,7 +55,6 @@ import { linkifyElement, topicToHtml } from "../../HtmlUtils";
import { useDispatcher } from "../../hooks/useDispatcher";
import { Action } from "../../dispatcher/actions";
import { IState, RovingTabIndexProvider, useRovingTabIndex } from "../../accessibility/RovingTabIndex";
import { getDisplayAliasForRoom } from "./RoomDirectory";
import MatrixClientContext from "../../contexts/MatrixClientContext";
import { useTypedEventEmitterState } from "../../hooks/useEventEmitter";
import { IOOBData } from "../../stores/ThreepidInviteStore";
@@ -67,6 +66,7 @@ import { getKeyBindingsManager } from "../../KeyBindingsManager";
import { Alignment } from "../views/elements/Tooltip";
import { getTopic } from "../../hooks/room/useTopic";
import { SdkContextClass } from "../../contexts/SDKContext";
import { getDisplayAliasForAliasSet } from "../../Rooms";

interface IProps {
space: Room;
@@ -342,7 +342,8 @@ export const showRoom = (cli: MatrixClient, hierarchy: RoomHierarchy, roomId: st
}
}

const roomAlias = getDisplayAliasForRoom(room) || undefined;
const roomAlias = getDisplayAliasForAliasSet(room.canonical_alias, room.aliases) || undefined;

defaultDispatcher.dispatch<ViewRoomPayload>({
action: Action.ViewRoom,
should_peek: true,
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ import { IPublicRoomsChunkRoom } from "matrix-js-sdk/src/matrix";

import { linkifyAndSanitizeHtml } from "../../../../HtmlUtils";
import { _t } from "../../../../languageHandler";
import { getDisplayAliasForRoom } from "../../../structures/RoomDirectory";
import { getDisplayAliasForAliasSet } from "../../../../Rooms";

const MAX_NAME_LENGTH = 80;
const MAX_TOPIC_LENGTH = 800;
@@ -32,7 +32,7 @@ interface Props {
}

export function PublicRoomResultDetails({ room, labelId, descriptionId, detailsId }: Props): JSX.Element {
let name = room.name || getDisplayAliasForRoom(room) || _t('Unnamed room');
let name = room.name || getDisplayAliasForAliasSet(room.canonical_alias, room.aliases) || _t('Unnamed room');
if (name.length > MAX_NAME_LENGTH) {
name = `${name.substring(0, MAX_NAME_LENGTH)}...`;
}
112 changes: 0 additions & 112 deletions src/components/views/elements/DirectorySearchBox.tsx

This file was deleted.

179 changes: 0 additions & 179 deletions src/components/views/rooms/PublicRoomTile.tsx

This file was deleted.