mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 21:45:26 +08:00
DEV: Move config area site setting fetch into new controller (#28136)
Followup 4aea12fdcb21216a528451c0f8803e02dff24998 In certain config areas (like About) we want to be able to fetch specific site settings by name. In this case, sometimes we need to be able to fetch hidden settings, in cases where a config area is still experimental. Splitting out a different endpoint for this purpose allows us to be stricter with what we return for config areas without affecting the main site settings UI, revealing hidden settings before they are ready.
This commit is contained in:
@ -21,23 +21,14 @@ RSpec.describe Admin::SiteSettingsController do
|
||||
expect(locale.length).to eq(1)
|
||||
end
|
||||
|
||||
describe "the filter_names param" do
|
||||
it "only returns settings that are specified in the filter_names param" do
|
||||
get "/admin/site_settings.json",
|
||||
params: {
|
||||
filter_names: %w[title site_description notification_email],
|
||||
}
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
json = response.parsed_body
|
||||
expect(json["site_settings"].size).to eq(3)
|
||||
expect(json["site_settings"].map { |s| s["setting"] }).to contain_exactly(
|
||||
"title",
|
||||
"site_description",
|
||||
"notification_email",
|
||||
)
|
||||
end
|
||||
it "does not return hidden site settings" do
|
||||
get "/admin/site_settings.json"
|
||||
expect(response.status).to eq(200)
|
||||
expect(
|
||||
response.parsed_body["site_settings"].find do |s|
|
||||
s["setting"] == "set_locale_from_cookie"
|
||||
end,
|
||||
).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user