mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 14:34:47 -04:00
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.
This commit is contained in:
parent
cf9a17a2b3
commit
4ac3a8c5dc
3 changed files with 20 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue