summary refs log tree commit diff
path: root/synapse/handlers/user_directory.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-05-31 13:30:12 +0100
committerErik Johnston <erik@matrix.org>2017-05-31 13:40:28 +0100
commitb5db4ed5f68ee81557393e94436d768b955b1aa0 (patch)
tree92465337ea1d72b1c81ae66f54f6126cb8b7a056 /synapse/handlers/user_directory.py
parentAdd call later (diff)
downloadsynapse-b5db4ed5f68ee81557393e94436d768b955b1aa0.tar.xz
Update room column when room becomes unpublic
Diffstat (limited to 'synapse/handlers/user_directory.py')
-rw-r--r--synapse/handlers/user_directory.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/synapse/handlers/user_directory.py b/synapse/handlers/user_directory.py
index e9488ce554..0cf403f599 100644
--- a/synapse/handlers/user_directory.py
+++ b/synapse/handlers/user_directory.py
@@ -121,12 +121,13 @@ class UserDirectoyHandler(object):
 
         # TODO: Make this faster?
         rooms = yield self.store.get_rooms_for_user(user_id)
-        for room_id in rooms:
+        for j_room_id in rooms:
             is_public = yield self.store.is_room_world_readable_or_publicly_joinable(
-                room_id
+                j_room_id
             )
 
             if is_public:
+                yield self.store.update_user_in_user_dir(user_id, j_room_id)
                 return
 
         yield self.store.remove_from_user_dir(user_id)
@@ -149,6 +150,15 @@ class UserDirectoyHandler(object):
                 if change is None:
                     continue
 
+                is_public = yield self.store.is_room_world_readable_or_publicly_joinable(
+                    room_id
+                )
+
+                if change and is_public:
+                    continue
+                elif not change and not is_public:
+                    continue
+
                 users_with_profile = yield self.state.get_current_user_in_room(room_id)
                 for user_id, profile in users_with_profile.iteritems():
                     if change:
@@ -164,6 +174,15 @@ class UserDirectoyHandler(object):
                 if change is None:
                     continue
 
+                is_public = yield self.store.is_room_world_readable_or_publicly_joinable(
+                    room_id
+                )
+
+                if change and is_public:
+                    continue
+                elif not change and not is_public:
+                    continue
+
                 users_with_profile = yield self.state.get_current_user_in_room(room_id)
                 for user_id, profile in users_with_profile.iteritems():
                     if change: