FEATURE: Default Composer Category Site Setting (#18967)

* FEATURE: Default Composer Category Site Setting

- Create the default_composer_category site setting
- Replace general_category_id logic for auto selecting the composer
  category
- Prevent Uncategorized from being selected if not allowed
- Add default_composer_category option to seeded categories
- Create a migration to populate the default_composer_category site
  setting if there is a general_category_id populated
- Added some tests

* Add missing translation for the new site setting

* fix some js tests

* Just check that the header value is null
This commit is contained in:
Blake Erickson
2022-11-14 11:09:57 -07:00
committed by GitHub
parent 8c48285145
commit 7be53b1588
10 changed files with 181 additions and 12 deletions

View File

@@ -1495,6 +1495,7 @@ en:
search_ignore_accents: "Ignore accents when searching for text."
category_search_priority_low_weight: "Weight applied to ranking for low category search priority."
category_search_priority_high_weight: "Weight applied to ranking for high category search priority."
default_composer_category: "The category used to pre-populate the category dropdown when creating a new topic."
allow_uncategorized_topics: "Allow topics to be created without a category. WARNING: If there are any uncategorized topics, you must recategorize them before turning this off."
allow_duplicate_topic_titles: "Allow topics with identical, duplicate titles."
allow_duplicate_topic_titles_category: "Allow topics with identical, duplicate titles if the category is different. allow_duplicate_topic_titles must be disabled."
@@ -2437,6 +2438,7 @@ en:
search_tokenize_japanese_enabled: "You must disable 'search_tokenize_japanese' before enabling this setting."
discourse_connect_cannot_be_enabled_if_second_factor_enforced: "You cannot enable DiscourseConnect if 2FA is enforced."
delete_rejected_email_after_days: "This setting cannot be set lower than the delete_email_logs_after_days setting or greater than %{max}"
invalid_uncategorized_category_setting: "The Uncategorized category cannot be selected if allow uncategorized topics is not allowed"
placeholder:
discourse_connect_provider_secrets:

View File

@@ -2339,6 +2339,11 @@ uncategorized:
uncategorized_category_id:
default: -1
hidden: true
default_composer_category:
client: true
type: category
default: ""
validator: "DefaultComposerCategoryValidator"
notify_about_flags_after:
type: float