summary refs log tree commit diff
path: root/synapse/handlers/message.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-01-25 18:31:41 +0000
committerErik Johnston <erik@matrix.org>2019-01-25 18:31:41 +0000
commitae2a957dbacc38f1126e2eca160f17322c710d26 (patch)
treeac1a5a65f1468214cc7e03a1e6a489f20ba65a74 /synapse/handlers/message.py
parentMerge pull request #4470 from matrix-org/erikj/require_format_version (diff)
downloadsynapse-ae2a957dbacc38f1126e2eca160f17322c710d26.tar.xz
Pass through room version to event auth
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r--synapse/handlers/message.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index 7aaa4fba33..10a7ed4c5e 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -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["room_version"]
+        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