diff options
Diffstat (limited to 'synapse/rest/profile.py')
-rw-r--r-- | synapse/rest/profile.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/synapse/rest/profile.py b/synapse/rest/profile.py index 2f010c0182..06076667c7 100644 --- a/synapse/rest/profile.py +++ b/synapse/rest/profile.py @@ -87,6 +87,27 @@ class ProfileAvatarURLRestServlet(RestServlet): return (200, {}) +class ProfileRestServlet(RestServlet): + PATTERN = client_path_pattern("/profile/(?P<user_id>[^/]*)") + + @defer.inlineCallbacks + def on_GET(self, request, user_id): + user = self.hs.parse_userid(user_id) + + displayname = yield self.handlers.profile_handler.get_displayname( + user, + ) + avatar_url = yield self.handlers.profile_handler.get_avatar_url( + user, + ) + + defer.returnValue((200, { + "displayname": displayname, + "avatar_url": avatar_url + })) + + def register_servlets(hs, http_server): ProfileDisplaynameRestServlet(hs).register(http_server) ProfileAvatarURLRestServlet(hs).register(http_server) + ProfileRestServlet(hs).register(http_server) |