Fix inability to join a knock room via space hierarchy view (#12404)

* Fix inability to join a `knock` room via space hierarchy view

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update src/components/structures/SpaceHierarchy.tsx

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>

* Add test

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update snapshot

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
Michael Telatynski 2024-04-11 12:18:16 +01:00 committed by GitHub
parent c40fea008a
commit 77dfc1abee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 122 additions and 7 deletions

View file

@ -41,6 +41,7 @@ import {
HistoryVisibility,
HierarchyRelation,
HierarchyRoom,
JoinRule,
} from "matrix-js-sdk/src/matrix";
import { RoomHierarchy } from "matrix-js-sdk/src/room-hierarchy";
import classNames from "classnames";
@ -158,7 +159,9 @@ const Tile: React.FC<ITileProps> = ({
<Spinner w={24} h={24} />
</AccessibleTooltipButton>
);
} else if (joinedRoom) {
} else if (joinedRoom || room.join_rule === JoinRule.Knock) {
// If the room is knockable, show the "View" button even if we are not a member; that
// allows us to reuse the "request to join" UX in RoomView.
button = (
<AccessibleButton
onClick={onPreviewClick}