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

Commit

Permalink
Space Room View should react to join rule changes down /sync
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy committed Oct 14, 2021
1 parent 4416212 commit 069a8d0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/structures/SpaceRoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import { useAsyncMemo } from "../../hooks/useAsyncMemo";
import Spinner from "../views/elements/Spinner";
import GroupAvatar from "../views/avatars/GroupAvatar";
import { useDispatcher } from "../../hooks/useDispatcher";
import { useRoomState } from "../../hooks/useRoomState";

import { logger } from "matrix-js-sdk/src/logger";

Expand Down Expand Up @@ -124,7 +125,7 @@ const useMyRoomMembership = (room: Room) => {
};

const SpaceInfo = ({ space }) => {
const joinRule = space.getJoinRule();
const joinRule = useRoomState(space, state => state.getJoinRule());

let visibilitySection;
if (joinRule === "public") {
Expand Down Expand Up @@ -204,8 +205,9 @@ const SpacePreview = ({ space, onJoinButtonClicked, onRejectButtonClicked }: ISp

const spacesEnabled = SpaceStore.spacesEnabled;

const joinRule = useRoomState(space, state => state.getJoinRule());
const cannotJoin = getEffectiveMembership(myMembership) === EffectiveMembership.Leave
&& space.getJoinRule() !== JoinRule.Public;
&& joinRule !== JoinRule.Public;

let inviterSection;
let joinButtons;
Expand Down

0 comments on commit 069a8d0

Please sign in to comment.