api: Add avatar URL to the GET /profile endpoint.

This endpoint is legacy in a lot of ways, but it seems reasonable that
it should have these data.
This commit is contained in:
Tim Abbott
2019-09-27 12:07:03 -07:00
parent c298163a67
commit bf088519a7
3 changed files with 7 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
# Get profile
Get the profile of the user/bot that requests this endpoint.
Get basic data about the user/bot that requests this endpoint.
`GET {{ api_url }}/v1/users/me`

View File

@@ -1188,6 +1188,10 @@ paths:
allOf:
- $ref: '#/components/schemas/JsonSuccess'
- properties:
avatar_url:
type: string
description: "URL for the user's avatar"
example: "x"
client_id:
type: string
description: NA
@@ -1226,6 +1230,7 @@ paths:
example: 1
- example:
{
"avatar_url": "https://secure.gravatar.com/avatar/af4f06322c177ef4e1e9b2c424986b54?d=identicon&version=1",
"client_id": "74c768b081076fdb3c4326256c17467e",
"email": "iago@zulip.com",
"full_name": "Iago",

View File

@@ -518,6 +518,7 @@ def get_profile_backend(request: HttpRequest, user_profile: UserProfile) -> Http
client_id = generate_client_id(),
max_message_id = -1,
user_id = user_profile.id,
avatar_url = avatar_url(user_profile),
full_name = user_profile.full_name,
email = user_profile.email,
is_bot = user_profile.is_bot,