+ {supportsSpaceFiltering && (
+
+ {_t("Search for public spaces")}
+
+ )}
);
} else {
diff --git a/src/components/views/spaces/SpaceSettingsVisibilityTab.tsx b/src/components/views/spaces/SpaceSettingsVisibilityTab.tsx
index 75df665b90..a2047ca950 100644
--- a/src/components/views/spaces/SpaceSettingsVisibilityTab.tsx
+++ b/src/components/views/spaces/SpaceSettingsVisibilityTab.tsx
@@ -40,7 +40,9 @@ const SpaceSettingsVisibilityTab: React.FC = ({ matrixClient: cli, space
const [error, setError] = useState("");
const serverSupportsExploringSpaces = useAsyncMemo(
async (): Promise => {
- return cli.doesServerSupportUnstableFeature("org.matrix.msc3827.stable");
+ return cli.isVersionSupported("v1.4").then((supported) => {
+ return supported || cli.doesServerSupportUnstableFeature("org.matrix.msc3827.stable");
+ });
},
[cli],
false,
diff --git a/src/dispatcher/actions.ts b/src/dispatcher/actions.ts
index b08e09141d..8b699cbec2 100644
--- a/src/dispatcher/actions.ts
+++ b/src/dispatcher/actions.ts
@@ -366,4 +366,9 @@ export enum Action {
* Fired when requesting to cancel an ask to join a room. Use with a CancelAskToJoinPayload.
*/
CancelAskToJoin = "cancel_ask_to_join",
+
+ /**
+ * Fired when we want to open spotlight search. Use with a OpenSpotlightPayload.
+ */
+ OpenSpotlight = "open_spotlight",
}
diff --git a/src/dispatcher/payloads/OpenSpotlightPayload.ts b/src/dispatcher/payloads/OpenSpotlightPayload.ts
new file mode 100644
index 0000000000..d3c8b82d68
--- /dev/null
+++ b/src/dispatcher/payloads/OpenSpotlightPayload.ts
@@ -0,0 +1,26 @@
+/*
+Copyright 2023 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.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+import { Action } from "../actions";
+import { ActionPayload } from "../payloads";
+import { Filter } from "../../components/views/dialogs/spotlight/Filter";
+
+export interface OpenSpotlightPayload extends ActionPayload {
+ action: Action.OpenSpotlight;
+
+ initialFilter?: Filter;
+ initialText?: string;
+}
diff --git a/src/hooks/spotlight/useDebouncedCallback.ts b/src/hooks/spotlight/useDebouncedCallback.ts
index e7524bf932..eb681e7a06 100644
--- a/src/hooks/spotlight/useDebouncedCallback.ts
+++ b/src/hooks/spotlight/useDebouncedCallback.ts
@@ -20,7 +20,7 @@ const DEBOUNCE_TIMEOUT = 100;
export function useDebouncedCallback(
enabled: boolean,
- callback: (...params: T) => void,
+ callback: (...params: T) => unknown,
params: T,
): void {
useEffect(() => {
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index 64a3bb662e..9fb7f99f7f 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -992,8 +992,6 @@
"New Notification Settings": "New Notification Settings",
"Notification Settings": "Notification Settings",
"Introducing a simpler way to change your notification settings. Customize your %(brand)s, just the way you like.": "Introducing a simpler way to change your notification settings. Customize your %(brand)s, just the way you like.",
- "Explore public spaces in the new search dialog": "Explore public spaces in the new search dialog",
- "Requires your server to support the stable version of MSC3827": "Requires your server to support the stable version of MSC3827",
"Let moderators hide messages pending moderation.": "Let moderators hide messages pending moderation.",
"Report to moderators": "Report to moderators",
"In rooms that support moderation, the “Report” button will let you report abuse to room moderators.": "In rooms that support moderation, the “Report” button will let you report abuse to room moderators.",
@@ -1269,7 +1267,7 @@
"Open space for anyone, best for communities": "Open space for anyone, best for communities",
"Private": "Private",
"Invite only, best for yourself or teams": "Invite only, best for yourself or teams",
- "To join a space you'll need an invite.": "To join a space you'll need an invite.",
+ "Search for public spaces": "Search for public spaces",
"Go back": "Go back",
"Your public space": "Your public space",
"Your private space": "Your private space",
@@ -3254,14 +3252,13 @@
"one": "%(count)s Member"
},
"Public rooms": "Public rooms",
+ "Public spaces": "Public spaces",
"Use \"%(query)s\" to search": "Use \"%(query)s\" to search",
"Search for": "Search for",
"View": "View",
"Spaces you're in": "Spaces you're in",
- "You cannot search for rooms that are neither a room nor a space": "You cannot search for rooms that are neither a room nor a space",
"Failed to query public rooms": "Failed to query public rooms",
- "Show rooms": "Show rooms",
- "Show spaces": "Show spaces",
+ "Failed to query public spaces": "Failed to query public spaces",
"Other rooms in %(spaceName)s": "Other rooms in %(spaceName)s",
"Join %(roomAddress)s": "Join %(roomAddress)s",
"Some results may be hidden for privacy": "Some results may be hidden for privacy",
diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx
index ceed24d183..7592c21209 100644
--- a/src/settings/Settings.tsx
+++ b/src/settings/Settings.tsx
@@ -252,20 +252,6 @@ export const SETTINGS: { [setting: string]: ISetting } = {
),
},
},
- "feature_exploring_public_spaces": {
- isFeature: true,
- labsGroup: LabGroup.Spaces,
- displayName: _td("Explore public spaces in the new search dialog"),
- supportedLevels: LEVELS_FEATURE,
- default: false,
- controller: new ServerSupportUnstableFeatureController(
- "feature_exploring_public_spaces",
- defaultWatchManager,
- [["org.matrix.msc3827.stable"]],
- "v1.4",
- _td("Requires your server to support the stable version of MSC3827"),
- ),
- },
"feature_msc3531_hide_messages_pending_moderation": {
isFeature: true,
labsGroup: LabGroup.Moderation,
diff --git a/test/components/views/dialogs/SpotlightDialog-test.tsx b/test/components/views/dialogs/SpotlightDialog-test.tsx
index 0a0c1eb6c6..44fd98c9f6 100644
--- a/test/components/views/dialogs/SpotlightDialog-test.tsx
+++ b/test/components/views/dialogs/SpotlightDialog-test.tsx
@@ -27,7 +27,8 @@ import {
import sanitizeHtml from "sanitize-html";
import { fireEvent, render, screen } from "@testing-library/react";
-import SpotlightDialog, { Filter } from "../../../../src/components/views/dialogs/spotlight/SpotlightDialog";
+import SpotlightDialog from "../../../../src/components/views/dialogs/spotlight/SpotlightDialog";
+import { Filter } from "../../../../src/components/views/dialogs/spotlight/Filter";
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
import { LocalRoom, LOCAL_ROOM_ID_PREFIX } from "../../../../src/models/LocalRoom";
import { DirectoryMember, startDmOnFirstMessage } from "../../../../src/utils/direct-messages";
@@ -352,12 +353,12 @@ describe("Spotlight Dialog", () => {
});
it("should find Rooms", () => {
- expect(options.length).toBe(3);
+ expect(options).toHaveLength(4);
expect(options[0]!.innerHTML).toContain(testRoom.name);
});
it("should not find LocalRooms", () => {
- expect(options.length).toBe(3);
+ expect(options).toHaveLength(4);
expect(options[0]!.innerHTML).not.toContain(testLocalRoom.name);
});
});
@@ -573,22 +574,4 @@ describe("Spotlight Dialog", () => {
expect(screen.getByText("Failed to query public rooms")).toBeInTheDocument();
});
-
- it("should show error both 'Show rooms' and 'Show spaces' are unchecked", async () => {
- jest.spyOn(SettingsStore, "getValue").mockImplementation((settingName, roomId, excludeDefault) => {
- if (settingName === "feature_exploring_public_spaces") {
- return true;
- } else {
- return []; // SpotlightSearch.recentSearches
- }
- });
- render( null} />);
-
- jest.advanceTimersByTime(200);
- await flushPromisesWithFakeTimers();
-
- fireEvent.click(screen.getByText("Show rooms"));
-
- expect(screen.getByText("You cannot search for rooms that are neither a room nor a space")).toBeInTheDocument();
- });
});
diff --git a/test/components/views/settings/tabs/user/LabsUserSettingsTab-test.tsx b/test/components/views/settings/tabs/user/LabsUserSettingsTab-test.tsx
index ead079cdf0..63c11290be 100644
--- a/test/components/views/settings/tabs/user/LabsUserSettingsTab-test.tsx
+++ b/test/components/views/settings/tabs/user/LabsUserSettingsTab-test.tsx
@@ -71,7 +71,7 @@ describe("", () => {
// non-beta labs section
expect(screen.getByText("Early previews")).toBeInTheDocument();
const labsSections = container.getElementsByClassName("mx_SettingsSubsection");
- expect(labsSections).toHaveLength(10);
+ expect(labsSections).toHaveLength(9);
});
it("allow setting a labs flag which requires unstable support once support is confirmed", async () => {
@@ -80,21 +80,21 @@ describe("", () => {
const deferred = defer();
cli.doesServerSupportUnstableFeature.mockImplementation(async (featureName) => {
- return featureName === "org.matrix.msc3827.stable" ? deferred.promise : false;
+ return featureName === "org.matrix.msc3952_intentional_mentions" ? deferred.promise : false;
});
MatrixClientBackedController.matrixClient = cli;
const { queryByText } = render(getComponent());
expect(
- queryByText("Explore public spaces in the new search dialog")!
+ queryByText("Enable intentional mentions")!
.closest(".mx_SettingsFlag")!
.querySelector(".mx_AccessibleButton"),
).toHaveAttribute("aria-disabled", "true");
deferred.resolve(true);
await waitFor(() => {
expect(
- queryByText("Explore public spaces in the new search dialog")!
+ queryByText("Enable intentional mentions")!
.closest(".mx_SettingsFlag")!
.querySelector(".mx_AccessibleButton"),
).toHaveAttribute("aria-disabled", "false");
diff --git a/test/components/views/spaces/SpacePanel-test.tsx b/test/components/views/spaces/SpacePanel-test.tsx
index db6b64ecf4..c05db7ae8a 100644
--- a/test/components/views/spaces/SpacePanel-test.tsx
+++ b/test/components/views/spaces/SpacePanel-test.tsx
@@ -24,7 +24,7 @@ import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
import { MetaSpace, SpaceKey } from "../../../../src/stores/spaces";
import { shouldShowComponent } from "../../../../src/customisations/helpers/UIComponents";
import { UIComponent } from "../../../../src/settings/UIFeature";
-import { mkStubRoom, wrapInSdkContext } from "../../../test-utils";
+import { mkStubRoom, wrapInMatrixClientContext, wrapInSdkContext } from "../../../test-utils";
import { SdkContextClass } from "../../../../src/contexts/SDKContext";
import SpaceStore from "../../../../src/stores/spaces/SpaceStore";
import DMRoomMap from "../../../../src/utils/DMRoomMap";
@@ -122,9 +122,12 @@ describe("", () => {
isGuest: jest.fn(),
getAccountData: jest.fn(),
on: jest.fn(),
+ off: jest.fn(),
removeListener: jest.fn(),
+ isVersionSupported: jest.fn().mockResolvedValue(true),
+ doesServerSupportUnstableFeature: jest.fn().mockResolvedValue(false),
} as unknown as MatrixClient;
- const SpacePanel = wrapInSdkContext(UnwrappedSpacePanel, SdkContextClass.instance);
+ const SpacePanel = wrapInSdkContext(wrapInMatrixClientContext(UnwrappedSpacePanel), SdkContextClass.instance);
beforeAll(() => {
jest.spyOn(MatrixClientPeg, "get").mockReturnValue(mockClient);