From 6a907b15428e517b84717100e743d8200eda6d85 Mon Sep 17 00:00:00 2001 From: mjarr <87588014+mjarr@users.noreply.github.com> Date: Tue, 1 Nov 2022 16:06:38 +0100 Subject: [PATCH] Remove MSC3244 use from restricted room creation (#892) * Remove MSC3244 use from restricted room creation * Fix condition --- src/client/action/room.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/client/action/room.js b/src/client/action/room.js index a0a7525f..996c2680 100644 --- a/src/client/action/room.js +++ b/src/client/action/room.js @@ -236,16 +236,12 @@ 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.'); + const caps = await mx.getCapabilities(); + if (caps['m.room_versions'].available?.['9'] !== 'stable') { + throw new Error("ERROR: The server doesn't support restricted rooms"); + } + if (Number(caps['m.room_versions'].default) < 9) { + options.room_version = '9'; } options.initial_state.push({ type: 'm.room.join_rules',