mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
mute user: Add backend infrastructure code.
Adds backend code for the mute users feature. This is just infrastructure work (database interactions, helpers, tests, events, API docs etc) and does not involve any behavioral/semantic aspects of muted users. Adds POST and DELETE endpoints, to keep the URL scheme mostly consistent in terms of `users/me`. TODOs: 1. Add tests for exporting `zulip_muteduser` database table. 2. Add dedicated methods to python-zulip-api to be used in place of the current `client.call_endpoint` implementation.
This commit is contained in:
committed by
Tim Abbott
parent
89f6139505
commit
3bfcaa3968
@@ -601,6 +601,32 @@ def toggle_mute_topic(client: Client) -> None:
|
||||
validate_against_openapi_schema(result, "/users/me/subscriptions/muted_topics", "patch", "200")
|
||||
|
||||
|
||||
@openapi_test_function("/users/me/muted_users/{muted_user_id}:post")
|
||||
def add_user_mute(client: Client) -> None:
|
||||
ensure_users([10], ["hamlet"])
|
||||
# {code_example|start}
|
||||
# Mute user with ID 10
|
||||
muted_user_id = 10
|
||||
result = client.call_endpoint(url=f"/users/me/muted_users/{muted_user_id}", method="POST")
|
||||
# {code_example|end}
|
||||
|
||||
validate_against_openapi_schema(result, "/users/me/muted_users/{muted_user_id}", "post", "200")
|
||||
|
||||
|
||||
@openapi_test_function("/users/me/muted_users/{muted_user_id}:delete")
|
||||
def remove_user_mute(client: Client) -> None:
|
||||
ensure_users([10], ["hamlet"])
|
||||
# {code_example|start}
|
||||
# Unmute user with ID 10
|
||||
muted_user_id = 10
|
||||
result = client.call_endpoint(url=f"/users/me/muted_users/{muted_user_id}", method="DELETE")
|
||||
# {code_example|end}
|
||||
|
||||
validate_against_openapi_schema(
|
||||
result, "/users/me/muted_users/{muted_user_id}", "delete", "200"
|
||||
)
|
||||
|
||||
|
||||
@openapi_test_function("/mark_all_as_read:post")
|
||||
def mark_all_as_read(client: Client) -> None:
|
||||
|
||||
@@ -1352,6 +1378,8 @@ def test_users(client: Client, owner_client: Client) -> None:
|
||||
add_alert_words(client)
|
||||
remove_alert_words(client)
|
||||
deactivate_own_user(client, owner_client)
|
||||
add_user_mute(client)
|
||||
remove_user_mute(client)
|
||||
|
||||
|
||||
def test_streams(client: Client, nonadmin_client: Client) -> None:
|
||||
|
||||
Reference in New Issue
Block a user