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:
Sam Saffron
2019-05-07 11:00:09 +10:00
parent 47995d2d89
commit 9be70a22cd
33 changed files with 99 additions and 73 deletions

View File

@ -95,7 +95,7 @@ class ImportScripts::Base
@site_settings_during_import = get_site_settings_for_import
@site_settings_during_import.each do |key, value|
@old_site_settings[key] = SiteSetting.send(key)
@old_site_settings[key] = SiteSetting.get(key)
SiteSetting.set(key, value)
end
@ -108,7 +108,7 @@ class ImportScripts::Base
def reset_site_settings
@old_site_settings.each do |key, value|
current_value = SiteSetting.send(key)
current_value = SiteSetting.get(key)
SiteSetting.set(key, value) unless current_value != @site_settings_during_import[key]
end