diff options
author | Erik Johnston <erik@matrix.org> | 2015-02-10 11:04:37 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-02-10 11:04:37 +0000 |
commit | c86ebe76736a4cde48cfb3229d894a174c6bd379 (patch) | |
tree | afc236e8ef1bdbd6d0686747b99743661522638e /synapse/api/auth.py | |
parent | Oops, we do want to defer.return regardless of whether we are caching or not (diff) | |
parent | Merge branch 'release-v0.6.2' of github.com:matrix-org/synapse into develop (diff) | |
download | synapse-c86ebe76736a4cde48cfb3229d894a174c6bd379.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into state-chache
Conflicts: synapse/app/homeserver.py synapse/state.py
Diffstat (limited to 'synapse/api/auth.py')
-rw-r--r-- | synapse/api/auth.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py index 7105ee21dc..0054745363 100644 --- a/synapse/api/auth.py +++ b/synapse/api/auth.py @@ -89,12 +89,19 @@ class Auth(object): raise @defer.inlineCallbacks - def check_joined_room(self, room_id, user_id): - member = yield self.state.get_current_state( - room_id=room_id, - event_type=EventTypes.Member, - state_key=user_id - ) + def check_joined_room(self, room_id, user_id, current_state=None): + if current_state: + member = current_state.get( + (EventTypes.Member, user_id), + None + ) + else: + member = yield self.state.get_current_state( + room_id=room_id, + event_type=EventTypes.Member, + state_key=user_id + ) + self._check_joined_room(member, user_id, room_id) defer.returnValue(member) @@ -102,7 +109,7 @@ class Auth(object): def check_host_in_room(self, room_id, host): curr_state = yield self.state.get_current_state(room_id) - for event in curr_state: + for event in curr_state.values(): if event.type == EventTypes.Member: try: if UserID.from_string(event.state_key).domain != host: |