summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-06-21 14:50:24 +0100
committerGitHub <noreply@github.com>2017-06-21 14:50:24 +0100
commitb668112320be62fe60582366bd3c6c9fa4f481a1 (patch)
tree8cbccbe76026f26b05a7544cc8d12f6aee38c96e /synapse/handlers
parentMerge pull request #2219 from krombel/avoid_duplicate_filters (diff)
parentInitialise exclusive_user_regex (diff)
downloadsynapse-b668112320be62fe60582366bd3c6c9fa4f481a1.tar.xz
Merge pull request #2296 from matrix-org/erikj/dont_appserver_shar
Don't work out users who share room with appservice users
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/user_directory.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/synapse/handlers/user_directory.py b/synapse/handlers/user_directory.py
index d33a20a1f2..c7a3acafcb 100644
--- a/synapse/handlers/user_directory.py
+++ b/synapse/handlers/user_directory.py
@@ -205,6 +205,10 @@ class UserDirectoyHandler(object):
                 count += 1
                 continue
 
+            if self.store.get_if_app_services_interested_in_user(user_id):
+                count += 1
+                continue
+
             for other_user_id in user_ids:
                 if user_id == other_user_id:
                     continue
@@ -411,8 +415,10 @@ class UserDirectoyHandler(object):
         to_insert = set()
         to_update = set()
 
+        is_appservice = self.store.get_if_app_services_interested_in_user(user_id)
+
         # First, if they're our user then we need to update for every user
-        if self.is_mine_id(user_id):
+        if self.is_mine_id(user_id) and not is_appservice:
             # Returns a map of other_user_id -> shared_private. We only need
             # to update mappings if for users that either don't share a room
             # already (aren't in the map) or, if the room is private, those that
@@ -443,7 +449,10 @@ class UserDirectoyHandler(object):
             if user_id == other_user_id:
                 continue
 
-            if self.is_mine_id(other_user_id):
+            is_appservice = self.store.get_if_app_services_interested_in_user(
+                other_user_id
+            )
+            if self.is_mine_id(other_user_id) and not is_appservice:
                 shared_is_private = yield self.store.get_if_users_share_a_room(
                     other_user_id, user_id,
                 )