diff options
author | Erik Johnston <erikj@jki.re> | 2019-01-28 20:09:38 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-28 20:09:38 +0000 |
commit | f1a04462ebfde48cbd42c42f05d67710a7f5955c (patch) | |
tree | 3bfb7acd4b72f69bc27299e19e37a133bea6bb63 /synapse/handlers/message.py | |
parent | Fix worker TLS (#4492) (diff) | |
parent | Correctly use default room version if none is set (diff) | |
download | synapse-f1a04462ebfde48cbd42c42f05d67710a7f5955c.tar.xz |
Merge pull request #4482 from matrix-org/erikj/event_auth_room_version
Pass through room version to event auth
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r-- | synapse/handlers/message.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 7aaa4fba33..67b364a6c3 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -22,7 +22,7 @@ from canonicaljson import encode_canonical_json, json from twisted.internet import defer from twisted.internet.defer import succeed -from synapse.api.constants import MAX_DEPTH, EventTypes, Membership +from synapse.api.constants import MAX_DEPTH, EventTypes, Membership, RoomVersions from synapse.api.errors import ( AuthError, Codes, @@ -611,8 +611,13 @@ class EventCreationHandler(object): extra_users (list(UserID)): Any extra users to notify about event """ + if event.is_state() and (event.type, event.state_key) == (EventTypes.Create, ""): + room_version = event.content.get("room_version", RoomVersions.V1) + else: + room_version = yield self.store.get_room_version(event.room_id) + try: - yield self.auth.check_from_context(event, context) + yield self.auth.check_from_context(room_version, event, context) except AuthError as err: logger.warn("Denying new event %r because %s", event, err) raise err |