zulip/zerver/actions
Zixuan James Li 268f858f39 linkifier: Support URL templates for linkifiers.
This swaps out url_format_string from all of our APIs and replaces it
with url_template. Note that the documentation changes in the following
commits  will be squashed with this commit.

We change the "url_format" key to "url_template" for the
realm_linkifiers events in event_schema, along with updating
LinkifierDict. "url_template" is the name chosen to normalize
mixed usages of "url_format_string" and "url_format" throughout
the backend.

The markdown processor is updated to stop handling the format string
interpolation and delegate the task template expansion to the uri_template
library instead.

This change affects many test cases. We mostly just replace "%(name)s"
with "{name}", "url_format_string" with "url_template" to make sure that
they still pass. There are some test cases dedicated for testing "%"
escaping, which aren't relevant anymore and are subject to removal.
But for now we keep most of them as-is, and make sure that "%" is always
escaped since we do not use it for variable substitution any more.

Since url_format_string is not populated anymore, a migration is created
to remove this field entirely, and make url_template non-nullable since
we will always populate it. Note that it is possible to have
url_template being null after migration 0422 and before 0424, but
in practice, url_template will not be None after backfilling and the
backend now is always setting url_template.

With the removal of url_format_string, RealmFilter model will now be cleaned
with URL template checks, and the old checks for escapes are removed.

We also modified RealmFilter.clean to skip the validation when the
url_template is invalid. This avoids raising mulitple ValidationError's
when calling full_clean on a linkifier. But we might eventually want to
have a more centric approach to data validation instead of having
the same validation in both the clean method and the validator.

Fixes #23124.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-04-19 12:20:49 -07:00
..
__init__.py
alert_words.py actions: Split out zerver.actions.alert_words. 2022-04-14 17:14:31 -07:00
bots.py bots: Allow changing bot owner without an acting_user. 2022-08-12 17:08:04 -07:00
create_realm.py auth: Rewrite data model for tracking enabled auth backends. 2023-04-18 09:22:56 -07:00
create_user.py registration: Remove redundant code. 2023-03-27 15:44:42 -07:00
custom_profile_fields.py markdown: Pass realm down into render_stream_description. 2022-11-01 08:20:47 -07:00
default_streams.py typing: Broaden type annotations for QuerySet compatibility. 2022-07-07 11:27:42 -07:00
hotspots.py actions: Split out zerver.actions.hotspots. 2022-04-14 17:14:31 -07:00
invites.py invite: Be more fair about the no-messages-sent warning flag. 2023-03-20 11:35:19 -07:00
message_delete.py ruff: Fix PLC0414 Import alias does not rename original package. 2022-12-04 22:11:24 -08:00
message_edit.py user_topics: Update 'do_update_message' to handle 'merge userTopic states'. 2023-04-18 16:40:57 -07:00
message_flags.py black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
message_send.py message: Use `recipient_type_name` for API message type references. 2023-04-18 12:29:33 -07:00
muted_users.py muted users: Make file naming consistent. 2023-02-10 15:39:57 -08:00
presence.py user-status: Move `do_update_user_status` to separate actions file. 2022-09-23 12:27:54 -07:00
reactions.py actions: Split out zerver.actions.reactions. 2022-04-14 17:14:35 -07:00
realm_domains.py black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
realm_emoji.py requirements: Upgrade Django to 4.1. 2022-10-06 15:59:07 -07:00
realm_export.py realm_export: Add transaction.atomic to export_realm. 2023-01-26 10:49:19 -08:00
realm_icon.py realm_audit_log: Explicitly stringify dict before insertion. 2022-07-26 09:48:33 -07:00
realm_linkifiers.py linkifier: Support URL templates for linkifiers. 2023-04-19 12:20:49 -07:00
realm_logo.py actions: Split out zerver.actions.realm_logo. 2022-04-14 17:14:31 -07:00
realm_playgrounds.py actions: Split out zerver.actions.realm_playgrounds. 2022-04-14 17:14:30 -07:00
realm_settings.py auth: Rewrite data model for tracking enabled auth backends. 2023-04-18 09:22:56 -07:00
streams.py streams: Refactor code to set group-based stream settings. 2023-02-22 12:17:46 -08:00
submessage.py actions: Split out zerver.actions.submessage. 2022-04-14 17:14:30 -07:00
typing.py black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
uploads.py upload: Rename delete_message_image to use word "attachment". 2023-03-02 16:36:19 -08:00
user_activity.py actions: Split out zerver.actions.user_activity. 2022-04-14 17:14:32 -07:00
user_groups.py user_groups: rename create_user_group to create_user_group_in_database. 2023-03-27 09:05:00 -07:00
user_settings.py user_settings: Create RealmAuditLog entries for all user settings. 2023-03-23 10:06:47 -07:00
user_status.py user-status: Stop updating the UserStatus model for `away` updates. 2022-09-23 12:27:54 -07:00
user_topics.py user_topics: Update 'set visibility policy' codepath for bulk db operations. 2023-03-29 09:50:06 -07:00
users.py actions: Implement do_delete_user_preserving_messages function. 2023-03-29 12:51:21 -07:00
video_calls.py