diff options
author | Nick Mills-Barrett <nick@beeper.com> | 2022-07-07 12:02:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-07 11:02:09 +0000 |
commit | 2b5ab8e3674b7d6003a5f17252c7933c2d6a381a (patch) | |
tree | 33edc4f6853303fa08ba904691cf40c4dd2de802 /synapse/handlers/profile.py | |
parent | Bump lxml from 4.8.0 to 4.9.1 (#13207) (diff) | |
download | synapse-2b5ab8e3674b7d6003a5f17252c7933c2d6a381a.tar.xz |
Use a single query in `ProfileHandler.get_profile` (#13209)
Diffstat (limited to 'synapse/handlers/profile.py')
-rw-r--r-- | synapse/handlers/profile.py | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/synapse/handlers/profile.py b/synapse/handlers/profile.py index 6eed3826a7..d8ff5289b5 100644 --- a/synapse/handlers/profile.py +++ b/synapse/handlers/profile.py @@ -67,19 +67,14 @@ class ProfileHandler: target_user = UserID.from_string(user_id) if self.hs.is_mine(target_user): - try: - displayname = await self.store.get_profile_displayname( - target_user.localpart - ) - avatar_url = await self.store.get_profile_avatar_url( - target_user.localpart - ) - except StoreError as e: - if e.code == 404: - raise SynapseError(404, "Profile was not found", Codes.NOT_FOUND) - raise + profileinfo = await self.store.get_profileinfo(target_user.localpart) + if profileinfo.display_name is None: + raise SynapseError(404, "Profile was not found", Codes.NOT_FOUND) - return {"displayname": displayname, "avatar_url": avatar_url} + return { + "displayname": profileinfo.display_name, + "avatar_url": profileinfo.avatar_url, + } else: try: result = await self.federation.make_query( |