summary refs log tree commit diff
path: root/synapse/events
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-07-23 16:28:00 +0100
committerErik Johnston <erik@matrix.org>2018-07-23 16:28:00 +0100
commit0faa3223cdf996aa18376a7420a43061a6691638 (patch)
tree3a00102320ac528b1e80f7168f44ad4edcdfca50 /synapse/events
parentMerge pull request #3581 from matrix-org/erikj/fixup_stateless (diff)
downloadsynapse-0faa3223cdf996aa18376a7420a43061a6691638.tar.xz
Fix missing attributes on workers.
This was missed during the transition from attribute to getter for
getting state from context.
Diffstat (limited to 'synapse/events')
-rw-r--r--synapse/events/snapshot.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse/events/snapshot.py b/synapse/events/snapshot.py
index e31eceb921..a59064b416 100644
--- a/synapse/events/snapshot.py
+++ b/synapse/events/snapshot.py
@@ -110,7 +110,8 @@ class EventContext(object):
 
         return context
 
-    def serialize(self, event):
+    @defer.inlineCallbacks
+    def serialize(self, event, store):
         """Converts self to a type that can be serialized as JSON, and then
         deserialized by `deserialize`
 
@@ -126,11 +127,12 @@ class EventContext(object):
         # the prev_state_ids, so if we're a state event we include the event
         # id that we replaced in the state.
         if event.is_state():
-            prev_state_id = self.prev_state_ids.get((event.type, event.state_key))
+            prev_state_ids = yield self.get_prev_state_ids(store)
+            prev_state_id = prev_state_ids.get((event.type, event.state_key))
         else:
             prev_state_id = None
 
-        return {
+        defer.returnValue({
             "prev_state_id": prev_state_id,
             "event_type": event.type,
             "event_state_key": event.state_key if event.is_state() else None,
@@ -140,7 +142,7 @@ class EventContext(object):
             "delta_ids": _encode_state_dict(self.delta_ids),
             "prev_state_events": self.prev_state_events,
             "app_service_id": self.app_service.id if self.app_service else None
-        }
+        })
 
     @staticmethod
     def deserialize(store, input):