mirror of
https://github.com/discourse/discourse.git
synced 2026-08-09 21:45:25 +08:00
This PR adds a shared `CategoryScopeSiteSetting` enum for category-scope
dropdowns.
The enum keeps the stored values short (`all`, `public`, `include`,
`include_strict`, `exclude`, `exclude_strict`) while letting the admin
UI show clearer labels like “Include selected categories (with
subcategories)”. This gives category-list settings a reusable way to
explain include/exclude and strict/non-strict behavior without making
the setting description do all the work.
Example usage:
```yaml
feature_name_category_scope:
type: enum
default: "public" # public categories
enum: "CategoryScopeSiteSetting"
client: false
area: "feature-name"
feature_name_categories:
type: category_list
default: ""
client: false
area: "feature-name"
depends_on:
- feature_name_category_scope
depends_on_values:
feature_name_category_scope:
- include
- include_strict
- exclude
- exclude_strict
depends_behavior: "hidden" # this settting will be hidden based on the depends_on_values
dependent_setting_display: "inline" # this setting will be displayed inline to the above
```
And suitable descriptions in `server.en.yml`
```yaml
feature_name_category_scope: "Choose which categories this feature can use. Include and exclude options use {{setting:feature_name_categories}}."
feature_name_categories: "Categories used when the category scope is set to <strong>include</strong> or <strong>exclude</strong>."
```
https://github.com/user-attachments/assets/d5255687-e995-4123-951b-2c784b315c0b
|
||
|---|---|---|
| .. | ||
| images | ||
| stylesheets | ||