Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Include user erased status when fetching user info via the admin API
Browse files Browse the repository at this point in the history
  • Loading branch information
tadzik committed Oct 20, 2022
1 parent 35c2a88 commit 84f27cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions synapse/handlers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ async def get_user(self, user: UserID) -> Optional[JsonDict]:
user_info_dict["avatar_url"] = profile.avatar_url
user_info_dict["threepids"] = threepids
user_info_dict["external_ids"] = external_ids
user_info_dict["erased"] = await self.store.is_user_erased(user.to_string())

return user_info_dict

Expand Down
3 changes: 3 additions & 0 deletions tests/rest/admin/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,7 @@ def test_deactivate_user_erase_true(self) -> None:
self.assertEqual("foo@bar.com", channel.json_body["threepids"][0]["address"])
self.assertEqual("mxc://servername/mediaid", channel.json_body["avatar_url"])
self.assertEqual("User1", channel.json_body["displayname"])
self.assertFalse(channel.json_body["erased"])

# Deactivate and erase user
channel = self.make_request(
Expand All @@ -1245,6 +1246,7 @@ def test_deactivate_user_erase_true(self) -> None:
self.assertEqual(0, len(channel.json_body["threepids"]))
self.assertIsNone(channel.json_body["avatar_url"])
self.assertIsNone(channel.json_body["displayname"])
self.assertTrue(channel.json_body["erased"])

self._is_erased("@user:test", True)

Expand Down Expand Up @@ -2783,6 +2785,7 @@ def _check_fields(self, content: JsonDict) -> None:
self.assertIn("avatar_url", content)
self.assertIn("admin", content)
self.assertIn("deactivated", content)
self.assertIn("erased", content)
self.assertIn("shadow_banned", content)
self.assertIn("creation_ts", content)
self.assertIn("appservice_id", content)
Expand Down

0 comments on commit 84f27cf

Please sign in to comment.