mirror of
https://github.com/zulip/zulip.git
synced 2025-10-27 01:53:59 +00:00
linkifiers: Update API to send data using dictionaries.
* This introduces a new event type `realm_linkifiers` and a new key for the initial data fetch of the same name. Newer clients will be expected to use these. * Backwards compatibility is ensured by changing neither the current event nor the /register key. The data which these hold is the same as before, but internally, it is generated by processing the `realm_linkifiers` data. We send both the old and the new event types to clients whenever the linkifiers are changed. Older clients will simply ignore the new event type, and vice versa. * The `realm/filters:GET` endpoint (which returns tuples) is currently used by none of the official Zulip clients. This commit replaces it with `realm/linkifiers:GET` which returns data in the new dictionary format. TODO: Update the `get_realm_filters` method in the API bindings, to hit this new URL instead of the old one. * This also updates the webapp frontend to use the newer events and keys.
This commit is contained in:
committed by
Tim Abbott
parent
5eff43f5d9
commit
3947b0c80a
@@ -781,9 +781,26 @@ def check_realm_export(
|
||||
assert has_failed_timestamp == (export["failed_timestamp"] is not None)
|
||||
|
||||
|
||||
# This type, like other instances of TupleType, is a legacy feature of
|
||||
# a very old Zulip API; we plan to replace it with an object as those
|
||||
# are more extensible.
|
||||
realm_linkifier_type = DictType(
|
||||
required_keys=[
|
||||
("pattern", str),
|
||||
("url_format", str),
|
||||
("id", int),
|
||||
]
|
||||
)
|
||||
|
||||
realm_linkifiers_event = event_dict_type(
|
||||
[
|
||||
("type", Equals("realm_linkifiers")),
|
||||
("realm_linkifiers", ListType(realm_linkifier_type)),
|
||||
]
|
||||
)
|
||||
check_realm_linkifiers = make_checker(realm_linkifiers_event)
|
||||
|
||||
|
||||
# This is a legacy event type to ensure backwards compatibility
|
||||
# for old clients. Newer clients should handle only the
|
||||
# "realm_linkifiers" event above.
|
||||
realm_filter_type = TupleType(
|
||||
[
|
||||
# we should make this an object
|
||||
|
||||
Reference in New Issue
Block a user