summary refs log tree commit diff
path: root/synapse/state.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-10-30 11:53:35 +0000
committerErik Johnston <erik@matrix.org>2014-10-30 11:53:35 +0000
commitda511334d26a3e2e6e3b8e3d57259896bcd4bb4c (patch)
tree2aabaa5b5b4b73797f9fea9f51d936704d524a48 /synapse/state.py
parentMerge branch 'develop' of github.com:matrix-org/synapse into federation_autho... (diff)
downloadsynapse-da511334d26a3e2e6e3b8e3d57259896bcd4bb4c.tar.xz
Make federation return the old current state, so that we can use it to do auth
Diffstat (limited to '')
-rw-r--r--synapse/state.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/synapse/state.py b/synapse/state.py
index 993c4f18d3..a59688e3b4 100644
--- a/synapse/state.py
+++ b/synapse/state.py
@@ -128,11 +128,15 @@ class StateHandler(object):
 
     @defer.inlineCallbacks
     @log_function
-    def annotate_state_groups(self, event, state=None):
-        if state:
+    def annotate_state_groups(self, event, old_state=None):
+        if old_state:
             event.state_group = None
-            event.old_state_events = None
-            event.state_events = {(s.type, s.state_key): s for s in state}
+            event.old_state_events = old_state
+            event.state_events = {(s.type, s.state_key): s for s in old_state}
+
+            if hasattr(event, "state_key"):
+                event.state_events[(event.type, event.state_key)] = event
+
             defer.returnValue(False)
             return
 
@@ -163,7 +167,7 @@ class StateHandler(object):
 
         event_ids = [
             e_id
-            for e_id, _ in events
+            for e_id, _, _ in events
         ]
 
         res = yield self.resolve_state_groups(event_ids)