mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 12:27:16 +08:00
FEATURE: Allow site settings to be edited throughout admin UI (#26154)
This commit makes it so the site settings filter controls and the list of settings input editors themselves can be used elsewhere in the admin UI outside of /admin/site_settings This allows us to provide more targeted groups of settings in different UI areas where it makes sense to provide them, such as on plugin pages. You could open a single page for a plugin where you can see information about that plugin, change settings, and configure it with custom UIs in the one place. In future we will do this in "config areas" for other parts of the admin UI.
This commit is contained in:
@ -171,4 +171,29 @@ RSpec.describe SiteSetting do
|
||||
|
||||
expect(settings.test_setting).to eq(value)
|
||||
end
|
||||
|
||||
describe "#all_settings" do
|
||||
it "does not include the `default_locale` setting if include_locale_setting is false" do
|
||||
expect(SiteSetting.all_settings.map { |s| s[:setting] }).to include("default_locale")
|
||||
expect(
|
||||
SiteSetting.all_settings(include_locale_setting: false).map { |s| s[:setting] },
|
||||
).not_to include("default_locale")
|
||||
end
|
||||
|
||||
it "does not include the `default_locale` setting if filter_categories are specified" do
|
||||
expect(
|
||||
SiteSetting.all_settings(filter_categories: ["branding"]).map { |s| s[:setting] },
|
||||
).not_to include("default_locale")
|
||||
end
|
||||
|
||||
it "does not include the `default_locale` setting if filter_plugin is specified" do
|
||||
expect(
|
||||
SiteSetting.all_settings(filter_plugin: "chat").map { |s| s[:setting] },
|
||||
).not_to include("default_locale")
|
||||
end
|
||||
|
||||
it "includes only settings for the specified category" do
|
||||
expect(SiteSetting.all_settings(filter_categories: ["required"]).count).to eq(12)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user