zulip/zerver/webhooks
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
..
airbrake markdown: Rewrite include plugin without markdown-include. 2022-06-26 17:36:31 -07:00
alertmanager alertmanager: Indent a documentation code block into its list item. 2023-02-27 11:49:36 -08:00
ansibletower black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
appfollow markdown: Rewrite include plugin without markdown-include. 2022-06-26 17:36:31 -07:00
appveyor black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
azuredevops integration: Refactor `get_pull_request_event_message` to use kwarg. 2023-03-28 15:51:43 -07:00
basecamp ruff: Fix ISC003 Explicitly concatenated string. 2023-01-04 16:25:07 -08:00
beanstalk webhooks: Pick a more reasonable length for short sha. 2022-11-08 08:20:51 -08:00
beeminder black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
bitbucket webhooks: Pick a more reasonable length for short sha. 2022-11-08 08:20:51 -08:00
bitbucket2 integration: Move assignee message to the end for git integrations. 2023-03-29 18:13:36 -07:00
bitbucket3 integration: Modify branch names for Bitbucket 3 events. 2023-03-29 18:13:36 -07:00
buildbot integrations: Add incoming webhook macro to relevant docs. 2022-09-09 16:31:33 -07:00
canarytoken markdown: Rewrite include plugin without markdown-include. 2022-06-26 17:36:31 -07:00
circleci circleci: Rewrite integration to support the new webhook format. 2022-11-15 10:45:05 -08:00
clubhouse black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
codeship markdown: Rewrite include plugin without markdown-include. 2022-06-26 17:36:31 -07:00
crashlytics markdown: Rewrite include plugin without markdown-include. 2022-06-26 17:36:31 -07:00
delighted markdown: Rewrite include plugin without markdown-include. 2022-06-26 17:36:31 -07:00
deskdotcom black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
dialogflow integrations: Add incoming webhook macro to relevant docs. 2022-09-09 16:31:33 -07:00
dropbox integrations-docs: Fix indentation issues in existing documentation. 2023-02-28 11:31:12 -08:00
errbit markdown: Rewrite include plugin without markdown-include. 2022-06-26 17:36:31 -07:00
flock markdown: Rewrite include plugin without markdown-include. 2022-06-26 17:36:31 -07:00
freshdesk tests: Call client methods with explicit keyword arguments. 2022-06-28 16:12:00 -07:00
freshping black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
freshstatus black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
front linkifier: Support URL templates for linkifiers. 2023-04-19 12:20:49 -07:00
gci ruff: Fix N818 exception name should be named with an Error suffix. 2022-11-17 16:52:00 -08:00
gitea integration: Remove branch names from Gitea edited PR event. 2023-04-07 15:17:23 -07:00
github webhooks: Add body to PR Review Event message for GitHub Integration. 2023-04-05 15:48:26 -07:00
gitlab integration: Move assignee message to the end for git integrations. 2023-03-29 18:13:36 -07:00
gocd black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
gogs integration: Remove branch names to Gogs edited PR event. 2023-04-02 23:06:15 -07:00
gosquared ruff: Fix N818 exception name should be named with an Error suffix. 2022-11-17 16:52:00 -08:00
grafana black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
greenhouse greenhouse: Strengthen types using WildValue. 2022-11-14 13:49:38 -08:00
groove ruff: Fix UP032 Use f-string instead of `format` call. 2023-01-23 11:18:36 -08:00
harbor black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
hellosign hellosign: Strengthen types using WildValue. 2022-11-14 13:49:38 -08:00
helloworld black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
heroku markdown: Rewrite include plugin without markdown-include. 2022-06-26 17:36:31 -07:00
homeassistant black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
honeybadger/fixtures
ifttt black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
insping black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
intercom intercom: Return success on HEAD requests. 2023-01-06 13:32:47 -08:00
jira ruff: Fix RSE102 Unnecessary parentheses on raised exception. 2023-02-04 16:34:55 -08:00
jotform jotform: Strengthen types using WildValue. 2022-11-14 13:49:38 -08:00
json black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
librato Fix typos caught by typos. 2023-01-03 11:09:50 -08:00
lidarr ruff: Fix N818 exception name should be named with an Error suffix. 2022-11-17 16:52:00 -08:00
mention mention: Strengthen types using WildValue. 2022-09-01 14:05:14 -07:00
netlify black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
newrelic black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
opbeat ruff: Fix SIM118 Use `key in dict` instead of `key in dict.keys()`. 2023-01-04 16:25:07 -08:00
opencollective black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
opsgenie black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
pagerduty Fix typos caught by typos. 2023-01-03 11:09:50 -08:00
papertrail black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
pingdom ruff: Fix N818 exception name should be named with an Error suffix. 2022-11-17 16:52:00 -08:00
pivotal ruff: Fix N818 exception name should be named with an Error suffix. 2022-11-17 16:52:00 -08:00
radarr ruff: Fix N818 exception name should be named with an Error suffix. 2022-11-17 16:52:00 -08:00
raygun ruff: Fix N818 exception name should be named with an Error suffix. 2022-11-17 16:52:00 -08:00
reviewboard ruff: Fix N818 exception name should be named with an Error suffix. 2022-11-17 16:52:00 -08:00
rhodecode ruff: Fix SIM102 nested `if` statements. 2023-01-23 11:18:36 -08:00
rollbar/fixtures
rundeck integrations: Add Rundeck webhook integration. 2023-04-07 10:13:21 -07:00
runscope/fixtures
semaphore black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
sentry webhooks: Handle explicit null context_line in Sentry. 2023-03-20 11:34:17 -07:00
slack black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
slack_incoming black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
solano webhooks: Use get_short_sha to get shortened sha. 2022-11-08 08:20:51 -08:00
sonarqube ruff: Fix SIM118 Use `key in dict` instead of `key in dict.keys()`. 2023-01-04 16:25:07 -08:00
sonarr ruff: Fix N818 exception name should be named with an Error suffix. 2022-11-17 16:52:00 -08:00
splunk black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
statuspage black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
stripe linkifier: Support URL templates for linkifiers. 2023-04-19 12:20:49 -07:00
taiga ruff: Fix SIM201 Use `… != …` instead of `not … == …`. 2023-01-23 11:18:36 -08:00
teamcity teamcity: Strengthen types using WildValue. 2022-09-01 14:05:14 -07:00
thinkst thinkst: Strengthen types using WildValue. 2022-09-01 14:05:14 -07:00
transifex ruff: Fix N818 exception name should be named with an Error suffix. 2022-11-17 16:52:00 -08:00
travis markdown: Rewrite include plugin without markdown-include. 2022-06-26 17:36:31 -07:00
trello black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
updown ruff: Fix N818 exception name should be named with an Error suffix. 2022-11-17 16:52:00 -08:00
uptimerobot uptimerobot: Use the create-bot-construct-url macro for uptimerobot. 2022-09-08 13:37:35 -07:00
wekan integrations-docs: Fix indentation issues in existing documentation. 2023-02-28 11:31:12 -08:00
wordpress black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
zabbix black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
zapier integrations: Update Asana integration doc to point to Zapier. 2023-03-02 13:51:34 -08:00
zendesk integrations: Add incoming webhook macro to relevant docs. 2022-09-09 16:31:33 -07:00
__init__.py