mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 03:16:41 +08:00
Fix the build take 2.
This commit is contained in:
parent
2220345a8b
commit
861b52b6f3
|
@ -16,7 +16,11 @@ module SiteSettings::DeprecatedSettings
|
|||
|
||||
def setup_deprecated_methods
|
||||
DEPRECATED_SETTINGS.each do |old_setting, new_setting, override, version|
|
||||
SiteSetting.singleton_class.public_send(:alias_method, :"_#{old_setting}", :"#{old_setting}")
|
||||
unless override
|
||||
SiteSetting.singleton_class.public_send(
|
||||
:alias_method, :"_#{old_setting}", :"#{old_setting}"
|
||||
)
|
||||
end
|
||||
|
||||
define_singleton_method old_setting do |warn: true|
|
||||
if warn
|
||||
|
@ -30,7 +34,11 @@ module SiteSettings::DeprecatedSettings
|
|||
self.public_send(override ? new_setting : "_#{old_setting}")
|
||||
end
|
||||
|
||||
SiteSetting.singleton_class.public_send(:alias_method, :"_#{old_setting}?", :"#{old_setting}?")
|
||||
unless override
|
||||
SiteSetting.singleton_class.public_send(
|
||||
:alias_method, :"_#{old_setting}?", :"#{old_setting}?"
|
||||
)
|
||||
end
|
||||
|
||||
define_singleton_method "#{old_setting}?" do |warn: true|
|
||||
if warn
|
||||
|
@ -44,7 +52,11 @@ module SiteSettings::DeprecatedSettings
|
|||
self.public_send("#{override ? new_setting : "_" + old_setting}?")
|
||||
end
|
||||
|
||||
SiteSetting.singleton_class.public_send(:alias_method, :"_#{old_setting}=", :"#{old_setting}=")
|
||||
unless override
|
||||
SiteSetting.singleton_class.public_send(
|
||||
:alias_method, :"_#{old_setting}=", :"#{old_setting}="
|
||||
)
|
||||
end
|
||||
|
||||
define_singleton_method "#{old_setting}=" do |val, warn: true|
|
||||
if warn
|
||||
|
|
|
@ -163,9 +163,12 @@ describe SiteSetting do
|
|||
|
||||
it 'should act as a proxy to the new methods' do
|
||||
begin
|
||||
SiteSettings::DeprecatedSettings::DEPRECATED_SETTINGS.push(%w{
|
||||
use_https force_https 0.0.1
|
||||
})
|
||||
original_settings = SiteSettings::DeprecatedSettings::DEPRECATED_SETTINGS
|
||||
SiteSettings::DeprecatedSettings::DEPRECATED_SETTINGS.clear
|
||||
|
||||
SiteSettings::DeprecatedSettings::DEPRECATED_SETTINGS.push([
|
||||
'use_https', 'force_https', true, '0.0.1'
|
||||
])
|
||||
|
||||
SiteSetting.setup_deprecated_methods
|
||||
|
||||
|
@ -183,7 +186,11 @@ describe SiteSetting do
|
|||
expect(SiteSetting.force_https).to eq(false)
|
||||
expect(SiteSetting.force_https?).to eq(false)
|
||||
ensure
|
||||
SiteSettings::DeprecatedSettings::DEPRECATED_SETTINGS.pop
|
||||
SiteSettings::DeprecatedSettings::DEPRECATED_SETTINGS.clear
|
||||
|
||||
SiteSettings::DeprecatedSettings::DEPRECATED_SETTINGS.concat(
|
||||
original_settings
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user