mirror of
https://github.com/discourse/discourse.git
synced 2024-12-30 07:03:47 +08:00
83361b2fc5
Many site settings can be distructive or have huge side-effects for a site that the admin may not be aware of when changing it. This commit introduces a `requires_confirmation` attribute that can be added to any site setting. When it is true, a confirmation dialog will open if that setting is changed in the admin UI, optionally with a custom message that is defined in client.en.yml. If the admin does not confirm, we reset the setting to its previous clean value and do not save the new value.
50 lines
1.8 KiB
Ruby
50 lines
1.8 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
describe "Admin Site Setting Search", type: :system do
|
|
let(:settings_page) { PageObjects::Pages::AdminSiteSettings.new }
|
|
fab!(:admin)
|
|
|
|
before do
|
|
SiteSetting.title = "Discourse"
|
|
sign_in(admin)
|
|
end
|
|
|
|
it "clears the filter" do
|
|
settings_page.visit
|
|
settings_page.type_in_search("min personal message post length")
|
|
expect(settings_page).to have_n_results(1)
|
|
settings_page.clear_search
|
|
expect(settings_page).to have_greater_than_n_results(1)
|
|
end
|
|
|
|
it "can show only overridden settings" do
|
|
overridden_setting_count = SiteSetting.all_settings(only_overridden: true).length
|
|
settings_page.visit
|
|
settings_page.toggle_only_show_overridden
|
|
assert_selector(".admin-detail .row.setting.overridden", count: overridden_setting_count)
|
|
settings_page.toggle_only_show_overridden
|
|
expect(settings_page).to have_greater_than_n_results(overridden_setting_count)
|
|
end
|
|
|
|
describe "when searching for keywords" do
|
|
it "finds the associated site setting" do
|
|
settings_page.visit
|
|
settings_page.type_in_search("anonymous_posting_min_trust_level")
|
|
expect(settings_page).to have_search_result("anonymous_posting_allowed_groups")
|
|
end
|
|
|
|
it "finds the associated site setting when many keywords" do
|
|
settings_page.visit
|
|
settings_page.type_in_search("deactivated")
|
|
expect(settings_page).to have_search_result("clean_up_inactive_users_after_days")
|
|
expect(settings_page).to have_search_result("purge_unactivated_users_grace_period_days")
|
|
end
|
|
|
|
it "can search for previous site setting without underscores" do
|
|
settings_page.visit
|
|
settings_page.type_in_search("anonymous posting min")
|
|
expect(settings_page).to have_search_result("anonymous_posting_allowed_groups")
|
|
end
|
|
end
|
|
end
|