deprecate existing site settings

This commit is contained in:
Arpit Jalan 2018-02-01 00:00:14 +05:30
parent 9bbfad1081
commit 350cbb1700
2 changed files with 44 additions and 4 deletions

View File

@ -2,7 +2,14 @@ module SiteSettings; end
module SiteSettings::DeprecatedSettings
DEPRECATED_SETTINGS = [
%w[use_https force_https 1.7]
%w[use_https force_https 1.7],
%w[min_private_message_post_length min_personal_message_post_length 2.0],
%w[min_private_message_title_length min_personal_message_title_length 2.0],
%w[enable_private_messages enable_personal_messages 2.0],
%w[enable_private_email_messages enable_personal_email_messages 2.0],
%w[private_email_time_window_seconds personal_email_time_window_seconds 2.0],
%w[max_private_messages_per_day max_personal_messages_per_day 2.0],
%w[default_email_private_messages default_email_personal_messages 2.0]
]
def setup_deprecated_methods

View File

@ -123,11 +123,12 @@ describe SiteSetting do
end
context 'deprecated site settings' do
before do
SiteSetting.force_https = true
end
describe '#use_https' do
before do
SiteSetting.force_https = true
end
it 'should act as a proxy to the new methods' do
expect(SiteSetting.use_https).to eq(true)
expect(SiteSetting.use_https?).to eq(true)
@ -138,5 +139,37 @@ describe SiteSetting do
expect(SiteSetting.force_https?).to eq(false)
end
end
describe 'rename private message to personal message' do
before do
SiteSetting.min_personal_message_title_length = 15
SiteSetting.enable_personal_messages = true
SiteSetting.personal_email_time_window_seconds = 15
SiteSetting.max_personal_messages_per_day = 15
SiteSetting.default_email_personal_messages = true
end
it 'should act as a proxy to the new methods' do
expect(SiteSetting.min_private_message_title_length).to eq(15)
SiteSetting.min_private_message_title_length = 5
expect(SiteSetting.min_personal_message_title_length).to eq(5)
expect(SiteSetting.enable_private_messages).to eq(true)
SiteSetting.enable_private_messages = false
expect(SiteSetting.enable_personal_messages).to eq(false)
expect(SiteSetting.private_email_time_window_seconds).to eq(15)
SiteSetting.private_email_time_window_seconds = 5
expect(SiteSetting.personal_email_time_window_seconds).to eq(5)
expect(SiteSetting.max_private_messages_per_day).to eq(15)
SiteSetting.max_private_messages_per_day = 5
expect(SiteSetting.max_personal_messages_per_day).to eq(5)
expect(SiteSetting.default_email_private_messages).to eq(true)
SiteSetting.default_email_private_messages = false
expect(SiteSetting.default_email_personal_messages).to eq(false)
end
end
end
end