api: Support user_id in get_user_presence_endpoint.

This is part of our general process of replacing emails, which are not
static with time, with user_ids when referring to users in the API.

We still keep the `email` reference option, since it can be useful for
linking third-party applications to Zulip on an intranet that might
have a user's corporate email handy and not want to do the extra round
trip to lookup the user.

The name of the parameter, user_id_or_email, was chosen to to make it
clear that the default/preferred option is user_id.

Fixes #14304.
This commit is contained in:
Tushar912
2021-01-05 00:06:00 +05:30
committed by Tim Abbott
parent dc67870e0c
commit 55de66f944
10 changed files with 64 additions and 20 deletions

View File

@@ -140,7 +140,7 @@ def test_authorization_errors_fatal(client: Client, nonadmin_client: Client) ->
validate_against_openapi_schema(result, "/users/me/subscriptions", "post", "400_1")
@openapi_test_function("/users/{email}/presence:get")
@openapi_test_function("/users/{user_id_or_email}/presence:get")
def get_user_presence(client: Client) -> None:
# {code_example|start}
@@ -148,7 +148,7 @@ def get_user_presence(client: Client) -> None:
result = client.get_user_presence("iago@zulip.com")
# {code_example|end}
validate_against_openapi_schema(result, "/users/{email}/presence", "get", "200")
validate_against_openapi_schema(result, "/users/{user_id_or_email}/presence", "get", "200")
@openapi_test_function("/users/me/presence:post")