mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 11:23:25 +08:00
validate markdown_linkify_tlds setting (#16485)
Prevent adding * as a value to markdown_linkify_tlds site setting
This commit is contained in:
parent
461936f211
commit
ee9daec36f
|
@ -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."
|
||||
|
|
|
@ -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
|
||||
|
|
16
lib/validators/markdown_linkify_tlds_validator.rb
Normal file
16
lib/validators/markdown_linkify_tlds_validator.rb
Normal file
|
@ -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
|
Loading…
Reference in New Issue
Block a user