summary refs log tree commit diff
path: root/synapse/handlers/presence.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-03-16 13:05:17 +0000
committerGitHub <noreply@github.com>2017-03-16 13:05:16 +0000
commit248eb4638d45b10e22820d5d03ab504e927a8422 (patch)
treec66ca7b4f6ad2bdcc22d017d72bbdf1145d1147d /synapse/handlers/presence.py
parentMerge pull request #2014 from Half-Shot/hs/fix-appservice-presence (diff)
parentComments (diff)
downloadsynapse-248eb4638d45b10e22820d5d03ab504e927a8422.tar.xz
Merge pull request #2022 from matrix-org/erikj/no_op_sync
Implement no op for room stream in sync
Diffstat (limited to 'synapse/handlers/presence.py')
-rw-r--r--synapse/handlers/presence.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py
index e562a2e87a..059260a8aa 100644
--- a/synapse/handlers/presence.py
+++ b/synapse/handlers/presence.py
@@ -557,9 +557,9 @@ class PresenceHandler(object):
         room_ids_to_states = {}
         users_to_states = {}
         for state in states:
-            events = yield self.store.get_rooms_for_user(state.user_id)
-            for e in events:
-                room_ids_to_states.setdefault(e.room_id, []).append(state)
+            room_ids = yield self.store.get_rooms_for_user(state.user_id)
+            for room_id in room_ids:
+                room_ids_to_states.setdefault(room_id, []).append(state)
 
             plist = yield self.store.get_presence_list_observers_accepted(state.user_id)
             for u in plist:
@@ -913,11 +913,12 @@ class PresenceHandler(object):
     def is_visible(self, observed_user, observer_user):
         """Returns whether a user can see another user's presence.
         """
-        observer_rooms = yield self.store.get_rooms_for_user(observer_user.to_string())
-        observed_rooms = yield self.store.get_rooms_for_user(observed_user.to_string())
-
-        observer_room_ids = set(r.room_id for r in observer_rooms)
-        observed_room_ids = set(r.room_id for r in observed_rooms)
+        observer_room_ids = yield self.store.get_rooms_for_user(
+            observer_user.to_string()
+        )
+        observed_room_ids = yield self.store.get_rooms_for_user(
+            observed_user.to_string()
+        )
 
         if observer_room_ids & observed_room_ids:
             defer.returnValue(True)