From 8bc41c2c32a903c9d3c2142aee2d06f779711d45 Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Sun, 27 Feb 2022 10:50:27 +0530 Subject: [PATCH] Fix bug when creating room Signed-off-by: Ajay Bura --- src/app/organisms/create-room/CreateRoom.jsx | 5 +---- src/client/action/room.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/app/organisms/create-room/CreateRoom.jsx b/src/app/organisms/create-room/CreateRoom.jsx index 20e7609..03dba8e 100644 --- a/src/app/organisms/create-room/CreateRoom.jsx +++ b/src/app/organisms/create-room/CreateRoom.jsx @@ -51,13 +51,10 @@ function CreateRoomContent({ isSpace, parentId, onRequestClose }) { useEffect(() => { const { roomList } = initMatrix; const onCreated = (roomId) => { - setJoinRule(false); - setIsEncrypted(true); - setIsValidAddress(null); setIsCreatingRoom(false); setCreatingError(null); + setIsValidAddress(null); setAddressValue(undefined); - setRoleIndex(0); if (!mx.getRoom(roomId)?.isSpaceRoom()) { selectRoom(roomId); diff --git a/src/client/action/room.js b/src/client/action/room.js index c6145be..1092751 100644 --- a/src/client/action/room.js +++ b/src/client/action/room.js @@ -224,6 +224,17 @@ async function createRoom(opts) { }); } if (parentId && joinRule === 'restricted') { + try { + const caps = await mx.getCapabilities(); + options.room_version = caps + ?.['m.room_versions'] + ?.['org.matrix.msc3244.room_capabilities'] + ?.restricted + ?.preferred + || undefined; + } catch { + console.error('Can\'t find room version for restricted.'); + } options.initial_state.push({ type: 'm.room.join_rules', content: {