summary refs log tree commit diff
path: root/synapse/api/auth.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-08-25 18:15:51 +0100
committerErik Johnston <erik@matrix.org>2016-08-25 18:15:51 +0100
commit0e1900d8193a612d6920a9eca0aec4813e17d355 (patch)
tree0fb6bb7026bb02525df63f6e06563ea54cfdef5e /synapse/api/auth.py
parentAdd desc (diff)
downloadsynapse-0e1900d8193a612d6920a9eca0aec4813e17d355.tar.xz
Pull out full state less
Diffstat (limited to 'synapse/api/auth.py')
-rw-r--r--synapse/api/auth.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py
index 40c3e9db0d..23a928de16 100644
--- a/synapse/api/auth.py
+++ b/synapse/api/auth.py
@@ -278,18 +278,19 @@ class Auth(object):
 
     @defer.inlineCallbacks
     def check_host_in_room(self, room_id, host):
-        curr_state = yield self.state.get_current_state(room_id)
+        curr_state_id = yield self.state.get_current_state_ids(room_id)
 
-        for event in curr_state.values():
-            if event.type == EventTypes.Member:
+        for (etype, state_key), event_id in curr_state_id.items():
+            if etype == EventTypes.Member:
                 try:
-                    if get_domain_from_id(event.state_key) != host:
+                    if get_domain_from_id(state_key) != host:
                         continue
                 except:
-                    logger.warn("state_key not user_id: %s", event.state_key)
+                    logger.warn("state_key not user_id: %s", state_key)
                     continue
 
-                if event.content["membership"] == Membership.JOIN:
+                event = yield self.store.get_event(event_id, allow_none=True)
+                if event and event.content["membership"] == Membership.JOIN:
                     defer.returnValue(True)
 
         defer.returnValue(False)