diff options
author | Paul "LeoNerd" Evans <paul@matrix.org> | 2014-09-02 13:30:36 +0100 |
---|---|---|
committer | Paul "LeoNerd" Evans <paul@matrix.org> | 2014-09-03 10:40:21 +0100 |
commit | ddf3ca7ab365fdc80817a1b43ea34e4e8afe5299 (patch) | |
tree | 43f060d7021061afe5148ad8a55db386ae63fce0 /synapse/handlers | |
parent | Do not show banned people in member list. Format ban events strings in room a... (diff) | |
download | synapse-ddf3ca7ab365fdc80817a1b43ea34e4e8afe5299.tar.xz |
Neater is_presence_visible() code
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/presence.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py index 9bfceda88a..8c1c2bf850 100644 --- a/synapse/handlers/presence.py +++ b/synapse/handlers/presence.py @@ -155,19 +155,18 @@ class PresenceHandler(BaseHandler): if observer_user == observed_user: defer.returnValue(True) - allowed_by_subscription = yield self.store.is_presence_visible( + if (yield self.store.do_users_share_a_room( + [observer_user, observed_user] + )): + defer.returnValue(True) + + if (yield self.store.is_presence_visible( observed_localpart=observed_user.localpart, observer_userid=observer_user.to_string(), - ) - - if allowed_by_subscription: + )): defer.returnValue(True) - share_room = yield self.store.do_users_share_a_room( - [observer_user, observed_user] - ) - - defer.returnValue(share_room) + defer.returnValue(False) @defer.inlineCallbacks def get_state(self, target_user, auth_user): |