summary refs log tree commit diff
path: root/synapse/events/snapshot.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2018-07-23 16:44:42 +0100
committerGitHub <noreply@github.com>2018-07-23 16:44:42 +0100
commita646bdc6705785a4634ce60e70c6113c1b6e8234 (patch)
tree3cb07ec6a145402f7661540d2779e94dffa7355b /synapse/events/snapshot.py
parentMerge pull request #3581 from matrix-org/erikj/fixup_stateless (diff)
parentNewsfile (diff)
downloadsynapse-a646bdc6705785a4634ce60e70c6113c1b6e8234.tar.xz
Merge pull request #3582 from matrix-org/erikj/fixup_stateless
Fix missing attributes on workers.
Diffstat (limited to 'synapse/events/snapshot.py')
-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):