mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Recalculate settings when dependent settings change
This commit is contained in:
@@ -111,6 +111,19 @@ class SiteSetting < ActiveRecord::Base
|
||||
SiteSetting.manual_polling_enabled? || SiteSetting.pop3_polling_enabled?
|
||||
end
|
||||
|
||||
WATCHED_SETTINGS ||= [
|
||||
:attachment_content_type_blacklist,
|
||||
:attachment_filename_blacklist,
|
||||
:unicode_username_character_whitelist,
|
||||
:markdown_typographer_quotation_marks
|
||||
]
|
||||
|
||||
def self.reset_cached_settings!
|
||||
@attachment_content_type_blacklist_regex = nil
|
||||
@attachment_filename_blacklist_regex = nil
|
||||
@unicode_username_whitelist_regex = nil
|
||||
end
|
||||
|
||||
def self.attachment_content_type_blacklist_regex
|
||||
@attachment_content_type_blacklist_regex ||= Regexp.union(SiteSetting.attachment_content_type_blacklist.split("|"))
|
||||
end
|
||||
@@ -120,7 +133,7 @@ class SiteSetting < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def self.unicode_username_character_whitelist_regex
|
||||
@unicode_username_whitelist_regex = SiteSetting.unicode_username_character_whitelist.present? \
|
||||
@unicode_username_whitelist_regex ||= SiteSetting.unicode_username_character_whitelist.present? \
|
||||
? Regexp.new(SiteSetting.unicode_username_character_whitelist) : nil
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user