fix unrelated issues

pull/21833/head
Michael Telatynski 2021-09-10 11:54:25 +01:00
parent cd73bbf2f5
commit d15ea932f6
2 changed files with 4 additions and 2 deletions

View File

@ -425,7 +425,7 @@ export default class SecurityRoomSettingsTab extends React.Component<IProps, ISt
} }
let advanced; let advanced;
if (this.state.joinRule === JoinRule.Public) { if (room.getJoinRule() === JoinRule.Public) {
advanced = ( advanced = (
<> <>
<AccessibleButton <AccessibleButton

View File

@ -27,6 +27,7 @@ import { useStateToggle } from "../../../hooks/useStateToggle";
import LabelledToggleSwitch from "../elements/LabelledToggleSwitch"; import LabelledToggleSwitch from "../elements/LabelledToggleSwitch";
import { useLocalEcho } from "../../../hooks/useLocalEcho"; import { useLocalEcho } from "../../../hooks/useLocalEcho";
import JoinRuleSettings from "../settings/JoinRuleSettings"; import JoinRuleSettings from "../settings/JoinRuleSettings";
import { useRoomState } from "../../../hooks/useRoomState";
interface IProps { interface IProps {
matrixClient: MatrixClient; matrixClient: MatrixClient;
@ -39,6 +40,7 @@ const SpaceSettingsVisibilityTab = ({ matrixClient: cli, space, closeSettingsFn
const userId = cli.getUserId(); const userId = cli.getUserId();
const joinRule = useRoomState(space, state => state.getJoinRule());
const [guestAccessEnabled, setGuestAccessEnabled] = useLocalEcho<boolean>( const [guestAccessEnabled, setGuestAccessEnabled] = useLocalEcho<boolean>(
() => space.currentState.getStateEvents(EventType.RoomGuestAccess, "") () => space.currentState.getStateEvents(EventType.RoomGuestAccess, "")
?.getContent()?.guest_access === GuestAccess.CanJoin, ?.getContent()?.guest_access === GuestAccess.CanJoin,
@ -64,7 +66,7 @@ const SpaceSettingsVisibilityTab = ({ matrixClient: cli, space, closeSettingsFn
const canonicalAliasEv = space.currentState.getStateEvents(EventType.RoomCanonicalAlias, ""); const canonicalAliasEv = space.currentState.getStateEvents(EventType.RoomCanonicalAlias, "");
let advancedSection; let advancedSection;
if (visibility === SpaceVisibility.Unlisted) { if (joinRule === JoinRule.Public) {
if (showAdvancedSection) { if (showAdvancedSection) {
advancedSection = <> advancedSection = <>
<AccessibleButton onClick={toggleAdvancedSection} kind="link" className="mx_SettingsTab_showAdvanced"> <AccessibleButton onClick={toggleAdvancedSection} kind="link" className="mx_SettingsTab_showAdvanced">