Avoid deprecated site setting logging in `SiteSetting.settings_hash`.
This commit is contained in:
parent
81b3bdaabd
commit
1a57be3248
|
@ -177,9 +177,17 @@ module SiteSettingExtension
|
||||||
|
|
||||||
def settings_hash
|
def settings_hash
|
||||||
result = {}
|
result = {}
|
||||||
|
deprecated_settings = SiteSettings::DeprecatedSettings::SETTINGS.map { |s| s[0] }
|
||||||
|
|
||||||
defaults.all.keys.each do |s|
|
defaults.all.keys.each do |s|
|
||||||
result[s] = send(s).to_s
|
result[s] =
|
||||||
|
if deprecated_settings.include?(s.to_s)
|
||||||
|
send(s, warn: false).to_s
|
||||||
|
else
|
||||||
|
send(s).to_s
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
module SiteSettings; end
|
module SiteSettings; end
|
||||||
|
|
||||||
module SiteSettings::DeprecatedSettings
|
module SiteSettings::DeprecatedSettings
|
||||||
DEPRECATED_SETTINGS = [
|
SETTINGS = [
|
||||||
['logo_url', 'logo', false, '2.4'],
|
['logo_url', 'logo', false, '2.4'],
|
||||||
['logo_small_url', 'logo_small', false, '2.4'],
|
['logo_small_url', 'logo_small', false, '2.4'],
|
||||||
['digest_logo_url', 'digest_logo', false, '2.4'],
|
['digest_logo_url', 'digest_logo', false, '2.4'],
|
||||||
|
@ -15,7 +15,7 @@ module SiteSettings::DeprecatedSettings
|
||||||
]
|
]
|
||||||
|
|
||||||
def setup_deprecated_methods
|
def setup_deprecated_methods
|
||||||
DEPRECATED_SETTINGS.each do |old_setting, new_setting, override, version|
|
SETTINGS.each do |old_setting, new_setting, override, version|
|
||||||
unless override
|
unless override
|
||||||
SiteSetting.singleton_class.public_send(
|
SiteSetting.singleton_class.public_send(
|
||||||
:alias_method, :"_#{old_setting}", :"#{old_setting}"
|
:alias_method, :"_#{old_setting}", :"#{old_setting}"
|
||||||
|
|
|
@ -163,10 +163,10 @@ describe SiteSetting do
|
||||||
|
|
||||||
it 'should act as a proxy to the new methods' do
|
it 'should act as a proxy to the new methods' do
|
||||||
begin
|
begin
|
||||||
original_settings = SiteSettings::DeprecatedSettings::DEPRECATED_SETTINGS
|
original_settings = SiteSettings::DeprecatedSettings::SETTINGS
|
||||||
SiteSettings::DeprecatedSettings::DEPRECATED_SETTINGS.clear
|
SiteSettings::DeprecatedSettings::SETTINGS.clear
|
||||||
|
|
||||||
SiteSettings::DeprecatedSettings::DEPRECATED_SETTINGS.push([
|
SiteSettings::DeprecatedSettings::SETTINGS.push([
|
||||||
'use_https', 'force_https', true, '0.0.1'
|
'use_https', 'force_https', true, '0.0.1'
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -186,9 +186,9 @@ describe SiteSetting do
|
||||||
expect(SiteSetting.force_https).to eq(false)
|
expect(SiteSetting.force_https).to eq(false)
|
||||||
expect(SiteSetting.force_https?).to eq(false)
|
expect(SiteSetting.force_https?).to eq(false)
|
||||||
ensure
|
ensure
|
||||||
SiteSettings::DeprecatedSettings::DEPRECATED_SETTINGS.clear
|
SiteSettings::DeprecatedSettings::SETTINGS.clear
|
||||||
|
|
||||||
SiteSettings::DeprecatedSettings::DEPRECATED_SETTINGS.concat(
|
SiteSettings::DeprecatedSettings::SETTINGS.concat(
|
||||||
original_settings
|
original_settings
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue