Allow specifying room ID when creating room

This commit is contained in:
Tulir Asokan 2023-02-12 14:35:30 +02:00
parent d0a50be89e
commit a0d9756c6f

View File

@ -857,11 +857,23 @@ class RoomCreationHandler:
visibility = config.get("visibility", "private") visibility = config.get("visibility", "private")
is_public = visibility == "public" is_public = visibility == "public"
room_id = await self._generate_and_create_room_id( if "room_id" in config:
creator_id=user_id, room_id = config["room_id"]
is_public=is_public, try:
room_version=room_version, await self.store.store_room(
) room_id=room_id,
room_creator_user_id=user_id,
is_public=is_public,
room_version=room_version,
)
except StoreError:
raise SynapseError(409, "Room ID already in use", errcode="M_CONFLICT")
else:
room_id = await self._generate_and_create_room_id(
creator_id=user_id,
is_public=is_public,
room_version=room_version,
)
# Check whether this visibility value is blocked by a third party module # Check whether this visibility value is blocked by a third party module
allowed_by_third_party_rules = await ( allowed_by_third_party_rules = await (