diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 92b0f58b58..dfd396f1ed 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -2404,6 +2404,7 @@ en: leading_trailing_slash: "The regular expression must not start and end with a slash." unicode_usernames_avatars: "The internal system avatars do not support Unicode usernames." list_value_count: "The list must contain exactly %{count} values." + markdown_linkify_tlds: "You cannot include a value of '*'." google_oauth2_hd_groups: "You must first set 'google oauth2 hd' before enabling this setting." search_tokenize_chinese_enabled: "You must disable 'search_tokenize_chinese' before enabling this setting." search_tokenize_japanese_enabled: "You must disable 'search_tokenize_japanese' before enabling this setting." diff --git a/config/site_settings.yml b/config/site_settings.yml index bbfa5ed640..4e4c836b14 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -847,6 +847,7 @@ posting: type: list default: "com|net|org|io|onion|co|tv|ru|cn|us|uk|me|de|fr|fi|gov" list_type: compact + validator: "MarkdownLinkifyTldsValidator" markdown_typographer_quotation_marks: client: true type: list diff --git a/lib/validators/markdown_linkify_tlds_validator.rb b/lib/validators/markdown_linkify_tlds_validator.rb new file mode 100644 index 0000000000..fbde202622 --- /dev/null +++ b/lib/validators/markdown_linkify_tlds_validator.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class MarkdownLinkifyTldsValidator + + def initialize(opts = {}) + @opts = opts + end + + def valid_value?(value) + !value.include?("*") + end + + def error_message + I18n.t("site_settings.errors.markdown_linkify_tlds") + end +end