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

Commit 68c94c6

Browse files
Update MSC3827 implementation to not change the default behaviour (#8936)
1 parent 3c14d93 commit 68c94c6

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/components/views/dialogs/spotlight/SpotlightDialog.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,9 @@ function refIsForRecentlyViewed(ref: RefObject<HTMLElement>): boolean {
103103
return ref.current?.id?.startsWith("mx_SpotlightDialog_button_recentlyViewed_") === true;
104104
}
105105

106-
function getRoomTypes(showRooms: boolean, showSpaces: boolean): Set<RoomType | null> | null {
106+
function getRoomTypes(showRooms: boolean, showSpaces: boolean): Set<RoomType | null> {
107107
const roomTypes = new Set<RoomType | null>();
108108

109-
// This is what servers not implementing MSC3827 are expecting
110-
if (showRooms && !showSpaces) return null;
111-
112109
if (showRooms) roomTypes.add(null);
113110
if (showSpaces) roomTypes.add(RoomType.Space);
114111

src/hooks/usePublicRoomDirectory.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ export const usePublicRoomDirectory = () => {
9191
if (query || roomTypes) {
9292
opts.filter = {
9393
"generic_search_term": query,
94-
"org.matrix.msc3827.room_types": roomTypes ? Array.from<RoomType | null>(roomTypes) : null,
94+
"org.matrix.msc3827.room_types": await MatrixClientPeg.get().doesServerSupportUnstableFeature(
95+
"org.matrix.msc3827",
96+
) ? Array.from<RoomType | null>(roomTypes) : null,
9597
};
9698
}
9799

0 commit comments

Comments
 (0)