diff options
author | Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> | 2019-05-23 15:00:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-23 15:00:20 +0100 |
commit | 6368150a748e9303f34948873af360d8a62347b6 (patch) | |
tree | 2191d61afc76c7b214aa8e9bb623cb14b8635d0c /synapse/handlers | |
parent | Store key validity time in the storage layer (diff) | |
download | synapse-6368150a748e9303f34948873af360d8a62347b6.tar.xz |
Add config option for setting homeserver's default room version (#5223)
Replaces DEFAULT_ROOM_VERSION constant with a method that first checks the config, then returns a hardcoded value if the option is not present. That hardcoded value is now located in the server.py config file.
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/room.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index e37ae96899..4a17911a87 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -27,7 +27,7 @@ from twisted.internet import defer from synapse.api.constants import EventTypes, JoinRules, RoomCreationPreset from synapse.api.errors import AuthError, Codes, NotFoundError, StoreError, SynapseError -from synapse.api.room_versions import DEFAULT_ROOM_VERSION, KNOWN_ROOM_VERSIONS +from synapse.api.room_versions import KNOWN_ROOM_VERSIONS from synapse.storage.state import StateFilter from synapse.types import RoomAlias, RoomID, RoomStreamToken, StreamToken, UserID from synapse.util import stringutils @@ -70,6 +70,7 @@ class RoomCreationHandler(BaseHandler): self.spam_checker = hs.get_spam_checker() self.event_creation_handler = hs.get_event_creation_handler() self.room_member_handler = hs.get_room_member_handler() + self.config = hs.config # linearizer to stop two upgrades happening at once self._upgrade_linearizer = Linearizer("room_upgrade_linearizer") @@ -475,7 +476,11 @@ class RoomCreationHandler(BaseHandler): if ratelimit: yield self.ratelimit(requester) - room_version = config.get("room_version", DEFAULT_ROOM_VERSION.identifier) + room_version = config.get( + "room_version", + self.config.default_room_version.identifier, + ) + if not isinstance(room_version, string_types): raise SynapseError( 400, |