mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 04:33:40 +08:00
5176c689e9
At some point in the past we decided to rename the 'regular' notification state of topics/categories to 'normal'. However, some UI copy was missed when the initial renaming was done so this commit changes the spots that were missed to the new name.
67 lines
2.0 KiB
Ruby
67 lines
2.0 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module SiteSettings; end
|
|
|
|
module SiteSettings::DeprecatedSettings
|
|
SETTINGS = [
|
|
# [<old setting>, <new_setting>, <override>, <version to drop>]
|
|
['search_tokenize_chinese_japanese_korean', 'search_tokenize_chinese', true, '2.9'],
|
|
['default_categories_regular', 'default_categories_normal', true, '3.0'],
|
|
]
|
|
|
|
def setup_deprecated_methods
|
|
SETTINGS.each do |old_setting, new_setting, override, version|
|
|
unless override
|
|
SiteSetting.singleton_class.public_send(
|
|
:alias_method, :"_#{old_setting}", :"#{old_setting}"
|
|
)
|
|
end
|
|
|
|
define_singleton_method old_setting do |warn: true|
|
|
if warn
|
|
Discourse.deprecate(
|
|
"`SiteSetting.#{old_setting}` has been deprecated. Please use `SiteSetting.#{new_setting}` instead.",
|
|
drop_from: version
|
|
)
|
|
end
|
|
|
|
self.public_send(override ? new_setting : "_#{old_setting}")
|
|
end
|
|
|
|
unless override
|
|
SiteSetting.singleton_class.public_send(
|
|
:alias_method, :"_#{old_setting}?", :"#{old_setting}?"
|
|
)
|
|
end
|
|
|
|
define_singleton_method "#{old_setting}?" do |warn: true|
|
|
if warn
|
|
Discourse.deprecate(
|
|
"`SiteSetting.#{old_setting}?` has been deprecated. Please use `SiteSetting.#{new_setting}?` instead.",
|
|
drop_from: version
|
|
)
|
|
end
|
|
|
|
self.public_send("#{override ? new_setting : "_" + old_setting}?")
|
|
end
|
|
|
|
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
|
|
Discourse.deprecate(
|
|
"`SiteSetting.#{old_setting}=` has been deprecated. Please use `SiteSetting.#{new_setting}=` instead.",
|
|
drop_from: version
|
|
)
|
|
end
|
|
|
|
self.public_send("#{override ? new_setting : "_" + old_setting}=", val)
|
|
end
|
|
end
|
|
end
|
|
end
|