feat: add handling for sub-room creation by setting parent-child relationships and copying join rules

This commit is contained in:
2026-03-15 23:44:53 +11:00
parent 27713572b5
commit 5eb937ab3e

View File

@@ -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;