From 5eb937ab3ecc0fe9b90e31a3c729c676a74bdf16 Mon Sep 17 00:00:00 2001 From: Max Litruv Boonzaayer Date: Sun, 15 Mar 2026 23:44:53 +1100 Subject: [PATCH] feat: add handling for sub-room creation by setting parent-child relationships and copying join rules --- .../features/create-room/CreateRoomModal.tsx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/app/features/create-room/CreateRoomModal.tsx b/src/app/features/create-room/CreateRoomModal.tsx index 4fa5e77..a68b658 100644 --- a/src/app/features/create-room/CreateRoomModal.tsx +++ b/src/app/features/create-room/CreateRoomModal.tsx @@ -64,6 +64,26 @@ function CreateRoomModal({ state }: CreateRoomModalProps) { parentSubRoomId ); + // Set m.space.child on the parent room pointing to this sub-room + await mx.sendStateEvent( + parentSubRoomId, + StateEvent.SpaceChild, + { via: viaServers }, + newRoomId + ); + + // Copy parent's join_rules to the sub-room + const parentJoinRulesEvent = parentRoom.currentState.getStateEvents(StateEvent.RoomJoinRules, ''); + if (parentJoinRulesEvent) { + const joinRulesContent = parentJoinRulesEvent.getContent(); + await mx.sendStateEvent( + newRoomId, + StateEvent.RoomJoinRules, + joinRulesContent, + '' + ); + } + // Add new room to parent's sub-rooms list const stateEvent = parentRoom.currentState.getStateEvents(StateEvent.PaarrotSubRooms, ''); const currentContent = stateEvent?.getContent() as PaarrotSubRoomsContent | undefined;