summary refs log tree commit diff
path: root/synapse/api
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-12-08 09:08:26 +0000
committerErik Johnston <erik@matrix.org>2014-12-08 09:08:26 +0000
commitd044121168672c657e595525af9b588c8769e9bb (patch)
tree3f79777ad368b4d5d4042a629c53146125fd15b3 /synapse/api
parentStart making more things use EventContext rather than event.* (diff)
downloadsynapse-d044121168672c657e595525af9b588c8769e9bb.tar.xz
Various typos and bug fixes.
Diffstat (limited to 'synapse/api')
-rw-r--r--synapse/api/auth.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py
index 3f2e58a5ef..821e3ba5e2 100644
--- a/synapse/api/auth.py
+++ b/synapse/api/auth.py
@@ -24,6 +24,7 @@ from synapse.api.events.room import (
     RoomJoinRulesEvent, RoomCreateEvent, RoomAliasesEvent,
 )
 from synapse.util.logutils import log_function
+from synapse.util.async import run_on_reactor
 from syutil.base64util import encode_base64
 
 import logging
@@ -352,17 +353,19 @@ class Auth(object):
 
     @defer.inlineCallbacks
     def add_auth_events(self, builder, context):
+        yield run_on_reactor()
+
         if builder.type == RoomCreateEvent.TYPE:
             builder.auth_events = []
             return
 
-        auth_events = []
+        auth_ids = []
 
         key = (RoomPowerLevelsEvent.TYPE, "", )
         power_level_event = context.current_state.get(key)
 
         if power_level_event:
-            auth_events.append(power_level_event.event_id)
+            auth_ids.append(power_level_event.event_id)
 
         key = (RoomJoinRulesEvent.TYPE, "", )
         join_rule_event = context.current_state.get(key)
@@ -373,7 +376,7 @@ class Auth(object):
         key = (RoomCreateEvent.TYPE, "", )
         create_event = context.current_state.get(key)
         if create_event:
-            auth_events.append(create_event.event_id)
+            auth_ids.append(create_event.event_id)
 
         if join_rule_event:
             join_rule = join_rule_event.content.get("join_rule")
@@ -385,15 +388,14 @@ class Auth(object):
             e_type = builder.content["membership"]
             if e_type in [Membership.JOIN, Membership.INVITE]:
                 if join_rule_event:
-                    auth_events.append(join_rule_event.event_id)
+                    auth_ids.append(join_rule_event.event_id)
 
                 if member_event and not is_public:
-                    auth_events.append(member_event.event_id)
+                    auth_ids.append(member_event.event_id)
         elif member_event:
             if member_event.content["membership"] == Membership.JOIN:
-                auth_events.append(member_event.event_id)
+                auth_ids.append(member_event.event_id)
 
-        auth_ids = [(a.event_id, h) for a, h in auth_events]
         auth_events_entries = yield self.store.add_event_hashes(
             auth_ids
         )