mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
linkifier: Support reordering linkifiers.
This adds API support to reorder linkifiers and makes sure that the returned lists of linkifiers from `GET /events`, `POST /register`, and `GET /realm/linkifiers` are always sorted with the order that they should processed when rendering linkifiers. We set the new `order` field to the ID with the migration. This preserves the order of the existing linkifiers. New linkifiers added will always be ordered the last. When reordering, the `order` field of all linkifiers in the same realm is updated, in a manner similar to how we implement ordering for `custom_profile_fields`.
This commit is contained in:
committed by
Tim Abbott
parent
011b4c1f7a
commit
37660dd0e7
@@ -392,6 +392,18 @@ def get_realm_linkifiers(client: Client) -> None:
|
||||
validate_against_openapi_schema(result, "/realm/linkifiers", "get", "200")
|
||||
|
||||
|
||||
@openapi_test_function("/realm/linkifiers:patch")
|
||||
def reorder_realm_linkifiers(client: Client) -> None:
|
||||
# {code_example|start}
|
||||
# Reorder the linkifiers in the user's organization.
|
||||
order = [4, 3, 2, 1]
|
||||
request = {"ordered_linkifier_ids": json.dumps(order)}
|
||||
|
||||
result = client.call_endpoint(url="/realm/linkifiers", method="PATCH", request=request)
|
||||
# {code_example|end}
|
||||
validate_against_openapi_schema(result, "/realm/linkifiers", "patch", "200")
|
||||
|
||||
|
||||
@openapi_test_function("/realm/profile_fields:get")
|
||||
def get_realm_profile_fields(client: Client) -> None:
|
||||
# {code_example|start}
|
||||
@@ -1629,6 +1641,7 @@ def test_server_organizations(client: Client) -> None:
|
||||
update_realm_filter(client)
|
||||
add_realm_playground(client)
|
||||
get_server_settings(client)
|
||||
reorder_realm_linkifiers(client)
|
||||
remove_realm_filter(client)
|
||||
remove_realm_playground(client)
|
||||
get_realm_emoji(client)
|
||||
|
||||
Reference in New Issue
Block a user