mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-04 22:40:29 +03:00
add knock_restricted
This commit is contained in:
parent
aaf8fa0cdd
commit
293c9b6b4d
1 changed files with 4 additions and 2 deletions
|
|
@ -12,6 +12,7 @@ import { IPowerLevels, powerLevelAPI } from '../../../hooks/usePowerLevels';
|
||||||
import { StateEvent } from '../../../../types/matrix/room';
|
import { StateEvent } from '../../../../types/matrix/room';
|
||||||
import { useMatrixClient } from '../../../hooks/useMatrixClient';
|
import { useMatrixClient } from '../../../hooks/useMatrixClient';
|
||||||
import { useStateEvent } from '../../../hooks/useStateEvent';
|
import { useStateEvent } from '../../../hooks/useStateEvent';
|
||||||
|
import { ExtendedJoinRules } from '../../../components/JoinRulesSwitcher';
|
||||||
|
|
||||||
type RoomPublishProps = {
|
type RoomPublishProps = {
|
||||||
powerLevels: IPowerLevels;
|
powerLevels: IPowerLevels;
|
||||||
|
|
@ -27,7 +28,7 @@ export function RoomPublish({ powerLevels }: RoomPublishProps) {
|
||||||
);
|
);
|
||||||
const joinRuleEvent = useStateEvent(room, StateEvent.RoomJoinRules);
|
const joinRuleEvent = useStateEvent(room, StateEvent.RoomJoinRules);
|
||||||
const content = joinRuleEvent?.getContent<RoomJoinRulesEventContent>();
|
const content = joinRuleEvent?.getContent<RoomJoinRulesEventContent>();
|
||||||
const rule: JoinRule = content?.join_rule ?? JoinRule.Invite;
|
const rule: ExtendedJoinRules = (content?.join_rule as ExtendedJoinRules) ?? JoinRule.Invite;
|
||||||
|
|
||||||
const { visibilityState, setVisibility } = useRoomDirectoryVisibility(room.roomId);
|
const { visibilityState, setVisibility } = useRoomDirectoryVisibility(room.roomId);
|
||||||
|
|
||||||
|
|
@ -35,7 +36,8 @@ export function RoomPublish({ powerLevels }: RoomPublishProps) {
|
||||||
|
|
||||||
const loading =
|
const loading =
|
||||||
visibilityState.status === AsyncStatus.Loading || toggleState.status === AsyncStatus.Loading;
|
visibilityState.status === AsyncStatus.Loading || toggleState.status === AsyncStatus.Loading;
|
||||||
const validRule = rule === JoinRule.Public || rule === JoinRule.Knock;
|
const validRule =
|
||||||
|
rule === JoinRule.Public || rule === JoinRule.Knock || rule === 'knock_restricted';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SequenceCard
|
<SequenceCard
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue