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:
Abhijeet Prasad Bodas
2021-03-30 16:21:54 +05:30
committed by Tim Abbott
parent 5eff43f5d9
commit 3947b0c80a
21 changed files with 297 additions and 90 deletions

View File

@@ -516,13 +516,13 @@ run_test("realm_emoji", (override) => {
}
});
run_test("linkifier", (override) => {
const event = event_fixtures.realm_filters;
page_params.realm_filters = [];
run_test("realm_linkifiers", (override) => {
const event = event_fixtures.realm_linkifiers;
page_params.realm_linkifiers = [];
override(settings_linkifiers, "populate_linkifiers", noop);
override(markdown, "update_linkifier_rules", noop);
dispatch(event);
assert_same(page_params.realm_filters, event.realm_filters);
assert_same(page_params.realm_linkifiers, event.realm_linkifiers);
});
run_test("realm_domains", (override) => {