summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorDirk Klimpel <5740567+dklimpel@users.noreply.github.com>2020-10-26 17:25:48 +0100
committerGitHub <noreply@github.com>2020-10-26 12:25:48 -0400
commit4ac3a8c5dcec00e8aa7a796b5bf05402133b49f0 (patch)
tree1a9fcefd6252f39b476fce5637e0580bd7a352ca /synapse
parentMerge tag 'v1.22.0rc2' into develop (diff)
downloadsynapse-4ac3a8c5dcec00e8aa7a796b5bf05402133b49f0.tar.xz
Fix a bug in the joined_rooms admin API (#8643)
If the user was not in any rooms then the API returned the same error
as if the user did not exist.
Diffstat (limited to 'synapse')
-rw-r--r--synapse/rest/admin/users.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/synapse/rest/admin/users.py b/synapse/rest/admin/users.py
index 8efefbc0a0..e71d9b0e1c 100644
--- a/synapse/rest/admin/users.py
+++ b/synapse/rest/admin/users.py
@@ -702,9 +702,10 @@ class UserMembershipRestServlet(RestServlet):
         if not self.is_mine(UserID.from_string(user_id)):
             raise SynapseError(400, "Can only lookup local users")
 
-        room_ids = await self.store.get_rooms_for_user(user_id)
-        if not room_ids:
-            raise NotFoundError("User not found")
+        user = await self.store.get_user_by_id(user_id)
+        if user is None:
+            raise NotFoundError("Unknown user")
 
+        room_ids = await self.store.get_rooms_for_user(user_id)
         ret = {"joined_rooms": list(room_ids), "total": len(room_ids)}
         return 200, ret