diff --git a/lib/site_setting_extension.rb b/lib/site_setting_extension.rb index 07bd5c4708e..f7be775807d 100644 --- a/lib/site_setting_extension.rb +++ b/lib/site_setting_extension.rb @@ -177,9 +177,17 @@ module SiteSettingExtension def settings_hash result = {} + deprecated_settings = SiteSettings::DeprecatedSettings::SETTINGS.map { |s| s[0] } + 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 + result end diff --git a/lib/site_settings/deprecated_settings.rb b/lib/site_settings/deprecated_settings.rb index 6d065dc19bc..e1fd68afa00 100644 --- a/lib/site_settings/deprecated_settings.rb +++ b/lib/site_settings/deprecated_settings.rb @@ -1,7 +1,7 @@ module SiteSettings; end module SiteSettings::DeprecatedSettings - DEPRECATED_SETTINGS = [ + SETTINGS = [ ['logo_url', 'logo', false, '2.4'], ['logo_small_url', 'logo_small', false, '2.4'], ['digest_logo_url', 'digest_logo', false, '2.4'], @@ -15,7 +15,7 @@ module SiteSettings::DeprecatedSettings ] 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 SiteSetting.singleton_class.public_send( :alias_method, :"_#{old_setting}", :"#{old_setting}" diff --git a/spec/models/site_setting_spec.rb b/spec/models/site_setting_spec.rb index 3942afe0bcc..6c6f556c29d 100644 --- a/spec/models/site_setting_spec.rb +++ b/spec/models/site_setting_spec.rb @@ -163,10 +163,10 @@ describe SiteSetting do it 'should act as a proxy to the new methods' do begin - original_settings = SiteSettings::DeprecatedSettings::DEPRECATED_SETTINGS - SiteSettings::DeprecatedSettings::DEPRECATED_SETTINGS.clear + original_settings = SiteSettings::DeprecatedSettings::SETTINGS + SiteSettings::DeprecatedSettings::SETTINGS.clear - SiteSettings::DeprecatedSettings::DEPRECATED_SETTINGS.push([ + SiteSettings::DeprecatedSettings::SETTINGS.push([ '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) ensure - SiteSettings::DeprecatedSettings::DEPRECATED_SETTINGS.clear + SiteSettings::DeprecatedSettings::SETTINGS.clear - SiteSettings::DeprecatedSettings::DEPRECATED_SETTINGS.concat( + SiteSettings::DeprecatedSettings::SETTINGS.concat( original_settings ) end