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') {
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.');
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',