summary refs log tree commit diff
path: root/synapse/rest/client
diff options
context:
space:
mode:
authorJonathan de Jong <jonathan@automatia.nl>2022-05-30 11:05:31 +0200
committerGitHub <noreply@github.com>2022-05-30 10:05:31 +0100
commit6be4953b998e4e4b730192b40642d2ec7bb0d7ad (patch)
treea0f94bb0abc1fdd2510dba751994e77d3eb7c624 /synapse/rest/client
parentLockStore: fix acquiring a lock via `LockStore.try_acquire_lock` (#12832) (diff)
downloadsynapse-6be4953b998e4e4b730192b40642d2ec7bb0d7ad.tar.xz
Mutual rooms: Remove dependency on user directory (#12836)
Diffstat (limited to 'synapse/rest/client')
-rw-r--r--synapse/rest/client/mutual_rooms.py15
1 files changed, 2 insertions, 13 deletions
diff --git a/synapse/rest/client/mutual_rooms.py b/synapse/rest/client/mutual_rooms.py
index 27bfaf0b29..38ef4e459f 100644
--- a/synapse/rest/client/mutual_rooms.py
+++ b/synapse/rest/client/mutual_rooms.py
@@ -42,21 +42,10 @@ class UserMutualRoomsServlet(RestServlet):
         super().__init__()
         self.auth = hs.get_auth()
         self.store = hs.get_datastores().main
-        self.user_directory_search_enabled = (
-            hs.config.userdirectory.user_directory_search_enabled
-        )
 
     async def on_GET(
         self, request: SynapseRequest, user_id: str
     ) -> Tuple[int, JsonDict]:
-
-        if not self.user_directory_search_enabled:
-            raise SynapseError(
-                code=400,
-                msg="User directory searching is disabled. Cannot determine shared rooms.",
-                errcode=Codes.UNKNOWN,
-            )
-
         UserID.from_string(user_id)
 
         requester = await self.auth.get_user_by_req(request)
@@ -67,8 +56,8 @@ class UserMutualRoomsServlet(RestServlet):
                 errcode=Codes.FORBIDDEN,
             )
 
-        rooms = await self.store.get_mutual_rooms_for_users(
-            requester.user.to_string(), user_id
+        rooms = await self.store.get_mutual_rooms_between_users(
+            frozenset((requester.user.to_string(), user_id))
         )
 
         return 200, {"joined": list(rooms)}