summary refs log tree commit diff
path: root/synapse/storage/events.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-01-21 14:04:19 +0000
committerErik Johnston <erik@matrix.org>2019-01-21 14:04:19 +0000
commit35e1d67b4e9c2c8b0abf35d41c2d9c56d486f6e3 (patch)
tree2c844b79665fc32b0bfc49285586394edf367131 /synapse/storage/events.py
parentNewsfile (diff)
parentMerge pull request #4390 from matrix-org/erikj/versioned_fed_apis (diff)
downloadsynapse-35e1d67b4e9c2c8b0abf35d41c2d9c56d486f6e3.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/fed_v2_invite_server
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r--synapse/storage/events.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index 2047110b1d..79e0276de6 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -739,7 +739,18 @@ class EventsStore(StateGroupWorkerStore, EventFederationStore, EventsWorkerStore
         }
 
         events_map = {ev.event_id: ev for ev, _ in events_context}
-        room_version = yield self.get_room_version(room_id)
+
+        # We need to get the room version, which is in the create event.
+        # Normally that'd be in the database, but its also possible that we're
+        # currently trying to persist it.
+        room_version = None
+        for ev, _ in events_context:
+            if ev.type == EventTypes.Create and ev.state_key == "":
+                room_version = ev.content.get("room_version", "1")
+                break
+
+        if not room_version:
+            room_version = yield self.get_room_version(room_id)
 
         logger.debug("calling resolve_state_groups from preserve_events")
         res = yield self._state_resolution_handler.resolve_state_groups(