Remove MSC3244 use from restricted room creation (#892)

* Remove MSC3244 use from restricted room creation

* Fix condition
This commit is contained in:
mjarr 2022-11-01 16:06:38 +01:00 committed by GitHub
parent bef759e358
commit 6a907b1542
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -236,16 +236,12 @@ async function createRoom(opts) {
}); });
} }
if (parentId && joinRule === 'restricted') { if (parentId && joinRule === 'restricted') {
try {
const caps = await mx.getCapabilities(); const caps = await mx.getCapabilities();
options.room_version = caps if (caps['m.room_versions'].available?.['9'] !== 'stable') {
?.['m.room_versions'] throw new Error("ERROR: The server doesn't support restricted rooms");
?.['org.matrix.msc3244.room_capabilities'] }
?.restricted if (Number(caps['m.room_versions'].default) < 9) {
?.preferred options.room_version = '9';
|| undefined;
} catch {
console.error('Can\'t find room version for restricted.');
} }
options.initial_state.push({ options.initial_state.push({
type: 'm.room.join_rules', type: 'm.room.join_rules',