mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
settings: Merge settings API endpoints.
This API change removes unnecessary complexity from a client that wants to change a user's personal settings, and also saves developers from needing to make decisions about what sort of setting something is at the API level. We preserve the old settings endpoints as mapping to the same function as the new one for backwards-compatibility. We delete the documentation for the old endpoints, though the documentation for the merged /settings endpoint mentions how to use the old endpoints when needed. We migrate all backend tests to the new endpoints, except for individual tests for each legacy endpoint to verify they still work. Co-authored-by: sahil839 <sahilbatra839@gmail.com>
This commit is contained in:
@@ -1132,35 +1132,20 @@ def get_server_settings(client: Client) -> None:
|
||||
validate_against_openapi_schema(result, "/server_settings", "get", "200")
|
||||
|
||||
|
||||
@openapi_test_function("/settings/notifications:patch")
|
||||
def update_notification_settings(client: Client) -> None:
|
||||
@openapi_test_function("/settings:patch")
|
||||
def update_settings(client: Client) -> None:
|
||||
|
||||
# {code_example|start}
|
||||
# Enable push notifications even when online
|
||||
# Enable push notifications even when online and change emojiset
|
||||
request = {
|
||||
"enable_offline_push_notifications": True,
|
||||
"enable_online_push_notifications": True,
|
||||
}
|
||||
result = client.update_notification_settings(request)
|
||||
# {code_example|end}
|
||||
|
||||
validate_against_openapi_schema(result, "/settings/notifications", "patch", "200")
|
||||
|
||||
|
||||
@openapi_test_function("/settings/display:patch")
|
||||
def update_display_settings(client: Client) -> None:
|
||||
|
||||
# {code_example|start}
|
||||
# Show user list on left sidebar in narrow windows.
|
||||
# Change emoji set used for display to Google modern.
|
||||
request = {
|
||||
"left_side_userlist": True,
|
||||
"emojiset": "google",
|
||||
}
|
||||
result = client.call_endpoint("settings/display", method="PATCH", request=request)
|
||||
result = client.call_endpoint("/settings", method="PATCH", request=request)
|
||||
# {code_example|end}
|
||||
|
||||
validate_against_openapi_schema(result, "/settings/display", "patch", "200")
|
||||
validate_against_openapi_schema(result, "/settings", "patch", "200")
|
||||
|
||||
|
||||
@openapi_test_function("/user_uploads:post")
|
||||
@@ -1488,8 +1473,7 @@ def test_users(client: Client, owner_client: Client) -> None:
|
||||
get_user_by_email(client)
|
||||
get_subscription_status(client)
|
||||
get_profile(client)
|
||||
update_notification_settings(client)
|
||||
update_display_settings(client)
|
||||
update_settings(client)
|
||||
upload_file(client)
|
||||
get_attachments(client)
|
||||
set_typing_status(client)
|
||||
@@ -1520,7 +1504,6 @@ def test_streams(client: Client, nonadmin_client: Client) -> None:
|
||||
remove_subscriptions(client)
|
||||
toggle_mute_topic(client)
|
||||
update_subscription_settings(client)
|
||||
update_notification_settings(client)
|
||||
get_stream_topics(client, 1)
|
||||
archive_stream(client, stream_id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user