mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-04 22:40:29 +03:00
default restrict access for space children in room create modal
This commit is contained in:
parent
cec9e4a7a0
commit
4f064bb765
1 changed files with 26 additions and 24 deletions
|
|
@ -76,27 +76,6 @@ export function CreateRoomKindSelector({
|
||||||
}: CreateRoomKindSelectorProps) {
|
}: CreateRoomKindSelectorProps) {
|
||||||
return (
|
return (
|
||||||
<Box shrink="No" direction="Column" gap="100">
|
<Box shrink="No" direction="Column" gap="100">
|
||||||
<SequenceCard
|
|
||||||
style={{ padding: config.space.S300 }}
|
|
||||||
variant={value === CreateRoomKind.Private ? 'Primary' : 'SurfaceVariant'}
|
|
||||||
direction="Column"
|
|
||||||
gap="100"
|
|
||||||
as="button"
|
|
||||||
type="button"
|
|
||||||
aria-pressed={value === CreateRoomKind.Private}
|
|
||||||
onClick={() => onSelect(CreateRoomKind.Private)}
|
|
||||||
disabled={disabled}
|
|
||||||
>
|
|
||||||
<SettingTile
|
|
||||||
before={<Icon size="400" src={Icons.HashLock} />}
|
|
||||||
after={value === CreateRoomKind.Private && <Icon src={Icons.Check} />}
|
|
||||||
>
|
|
||||||
<Text size="H6">Private</Text>
|
|
||||||
<Text size="T300" priority="300">
|
|
||||||
Only people with invite can join.
|
|
||||||
</Text>
|
|
||||||
</SettingTile>
|
|
||||||
</SequenceCard>
|
|
||||||
{canRestrict && (
|
{canRestrict && (
|
||||||
<SequenceCard
|
<SequenceCard
|
||||||
style={{ padding: config.space.S300 }}
|
style={{ padding: config.space.S300 }}
|
||||||
|
|
@ -120,6 +99,27 @@ export function CreateRoomKindSelector({
|
||||||
</SettingTile>
|
</SettingTile>
|
||||||
</SequenceCard>
|
</SequenceCard>
|
||||||
)}
|
)}
|
||||||
|
<SequenceCard
|
||||||
|
style={{ padding: config.space.S300 }}
|
||||||
|
variant={value === CreateRoomKind.Private ? 'Primary' : 'SurfaceVariant'}
|
||||||
|
direction="Column"
|
||||||
|
gap="100"
|
||||||
|
as="button"
|
||||||
|
type="button"
|
||||||
|
aria-pressed={value === CreateRoomKind.Private}
|
||||||
|
onClick={() => onSelect(CreateRoomKind.Private)}
|
||||||
|
disabled={disabled}
|
||||||
|
>
|
||||||
|
<SettingTile
|
||||||
|
before={<Icon size="400" src={Icons.HashLock} />}
|
||||||
|
after={value === CreateRoomKind.Private && <Icon src={Icons.Check} />}
|
||||||
|
>
|
||||||
|
<Text size="H6">Private</Text>
|
||||||
|
<Text size="T300" priority="300">
|
||||||
|
Only people with invite can join.
|
||||||
|
</Text>
|
||||||
|
</SettingTile>
|
||||||
|
</SequenceCard>
|
||||||
<SequenceCard
|
<SequenceCard
|
||||||
style={{ padding: config.space.S300 }}
|
style={{ padding: config.space.S300 }}
|
||||||
variant={value === CreateRoomKind.Public ? 'Primary' : 'SurfaceVariant'}
|
variant={value === CreateRoomKind.Public ? 'Primary' : 'SurfaceVariant'}
|
||||||
|
|
@ -137,7 +137,7 @@ export function CreateRoomKindSelector({
|
||||||
>
|
>
|
||||||
<Text size="H6">Public</Text>
|
<Text size="H6">Public</Text>
|
||||||
<Text size="T300" priority="300">
|
<Text size="T300" priority="300">
|
||||||
Anyone with the room address can join.
|
Anyone with the address can join.
|
||||||
</Text>
|
</Text>
|
||||||
</SettingTile>
|
</SettingTile>
|
||||||
</SequenceCard>
|
</SequenceCard>
|
||||||
|
|
@ -458,14 +458,16 @@ export function CreateRoomForm({ defaultKind, space, onCreate }: CreateRoomFormP
|
||||||
const capabilities = useCapabilities();
|
const capabilities = useCapabilities();
|
||||||
const roomVersion = capabilities['m.room_versions'];
|
const roomVersion = capabilities['m.room_versions'];
|
||||||
const [selectedRoomVersion, selectRoomVersion] = useState(roomVersion?.default ?? '1');
|
const [selectedRoomVersion, selectRoomVersion] = useState(roomVersion?.default ?? '1');
|
||||||
|
const allowRestricted = space && restrictedSupported(selectedRoomVersion);
|
||||||
|
|
||||||
const [kind, setKind] = useState(defaultKind ?? CreateRoomKind.Private);
|
const [kind, setKind] = useState(
|
||||||
|
defaultKind ?? allowRestricted ? CreateRoomKind.Restricted : CreateRoomKind.Private
|
||||||
|
);
|
||||||
const [federation, setFederation] = useState(true);
|
const [federation, setFederation] = useState(true);
|
||||||
const [encryption, setEncryption] = useState(false);
|
const [encryption, setEncryption] = useState(false);
|
||||||
const [knock, setKnock] = useState(false);
|
const [knock, setKnock] = useState(false);
|
||||||
const [advance, setAdvance] = useState(false);
|
const [advance, setAdvance] = useState(false);
|
||||||
|
|
||||||
const allowRestricted = space && restrictedSupported(selectedRoomVersion);
|
|
||||||
const allowKnock = kind === CreateRoomKind.Private && knockSupported(selectedRoomVersion);
|
const allowKnock = kind === CreateRoomKind.Private && knockSupported(selectedRoomVersion);
|
||||||
const allowKnockRestricted =
|
const allowKnockRestricted =
|
||||||
kind === CreateRoomKind.Restricted && knockRestrictedSupported(selectedRoomVersion);
|
kind === CreateRoomKind.Restricted && knockRestrictedSupported(selectedRoomVersion);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue