mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
DEV: introduce new API to look up dynamic site setting
This removes all uses of both `send` and `public_send` from consumers of SiteSetting and instead introduces a `get` helper for dynamic lookup This leads to much cleaner and safer code long term as we are always explicit to test that a site setting is really there before sending an arbitrary string to the class It also removes a couple of risky stubs from the auth provider test
This commit is contained in:
@ -12,7 +12,7 @@ class Typepad < Thor
|
||||
|
||||
backup_settings = {}
|
||||
%w(email_domains_blacklist).each do |s|
|
||||
backup_settings[s] = SiteSetting.send(s)
|
||||
backup_settings[s] = SiteSetting.get(s)
|
||||
end
|
||||
|
||||
user = User.where(username_lower: options[:post_as].downcase).first
|
||||
@ -26,7 +26,6 @@ class Typepad < Thor
|
||||
exit 1
|
||||
end
|
||||
|
||||
inside_block = true
|
||||
input = ""
|
||||
|
||||
entries = []
|
||||
@ -103,7 +102,7 @@ class Typepad < Thor
|
||||
ensure
|
||||
RateLimiter.enable
|
||||
backup_settings.each do |s, v|
|
||||
SiteSetting.send("#{s}=", v)
|
||||
SiteSetting.set(s, v)
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user