mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
linkifiers: Add an API to support the editing of linkifier.
This commit adds an API to `zproject/urls.py` to edit/update the realm linkifier. Its helper function to update the database is added in `zerver/lib/actions.py`. `zulip.yaml` is documented accordingly as well, clearly stating that this API updates one linkifier at a time. The tests are added for the API and helper function which updates the realm linkifier. Fixes #10830.
This commit is contained in:
@@ -372,6 +372,25 @@ def add_realm_filter(client: Client) -> None:
|
||||
validate_against_openapi_schema(result, "/realm/filters", "post", "200")
|
||||
|
||||
|
||||
@openapi_test_function("/realm/filters/{filter_id}:patch")
|
||||
def update_realm_filter(client: Client) -> None:
|
||||
|
||||
# {code_example|start}
|
||||
# Update the linkifier (realm_filter) with ID 1
|
||||
filter_id = 1
|
||||
request = {
|
||||
"pattern": "#(?P<id>[0-9]+)",
|
||||
"url_format_string": "https://github.com/zulip/zulip/issues/%(id)s",
|
||||
}
|
||||
|
||||
result = client.call_endpoint(
|
||||
url=f"/realm/filters/{filter_id}", method="PATCH", request=request
|
||||
)
|
||||
# {code_example|end}
|
||||
|
||||
validate_against_openapi_schema(result, "/realm/filters/{filter_id}", "patch", "200")
|
||||
|
||||
|
||||
@openapi_test_function("/realm/filters/{filter_id}:delete")
|
||||
def remove_realm_filter(client: Client) -> None:
|
||||
|
||||
@@ -1464,6 +1483,7 @@ def test_server_organizations(client: Client) -> None:
|
||||
|
||||
get_realm_linkifiers(client)
|
||||
add_realm_filter(client)
|
||||
update_realm_filter(client)
|
||||
add_realm_playground(client)
|
||||
get_server_settings(client)
|
||||
remove_realm_filter(client)
|
||||
|
||||
Reference in New Issue
Block a user