Simplify URL validation in related content

We were using `Setting["url"]` to verify the content belonged to the
application URL, but we can use `root_url` instead.

Note that means we need to include the port when filling in forms in the
tests, since in tests URL helpers like `polymorphic_url` don't include
the port, but a port is automatically added when actually making the
request.
This commit is contained in:
Javi Martín
2022-09-30 02:35:09 +02:00
parent f15f250150
commit adfb141d1b
4 changed files with 14 additions and 11 deletions

View File

@@ -13,7 +13,7 @@
<div class="input-group-field">
<%= text_field_tag :url, "",
"aria-describedby": "related_content_help_text",
placeholder: t("related_content.placeholder", url: setting["url"]) %>
placeholder: t("related_content.placeholder", url: root_url) %>
<%= hidden_field_tag :relationable_klass, relationable.class.name %>
<%= hidden_field_tag :relationable_id, relationable.id %>