Skip to content

A platform for community discussion. Free, open, simple.

FIX: Show Uncategorized in category-chooser (#25794)

Bianca Nenciu1df473b530c7
diff --git a/app/assets/javascripts/select-kit/addon/components/category-chooser.js b/app/assets/javascripts/select-kit/addon/components/category-chooser.js
index 7b3fdd8a918..002995186b1 100644
--- a/app/assets/javascripts/select-kit/addon/components/category-chooser.js
+++ b/app/assets/javascripts/select-kit/addon/components/category-chooser.js
@@ -17,7 +17,8 @@ export default ComboBoxComponent.extend({
selectKitOptions: {
filterable: true,
- allowUncategorized: false,
+ autoInsertNoneItem: false,
+ allowUncategorized: "allowUncategorizedTopics",
allowSubCategories: true,
permissionType: PermissionType.FULL,
excludeCategoryId: null,
@@ -54,10 +55,7 @@ export default ComboBoxComponent.extend({
I18n.t(isString ? this.selectKit.options.none : "category.none")
)
);
- } else if (
- this.allowUncategorizedTopics ||
- this.selectKit.options.allowUncategorized
- ) {
+ } else if (this.selectKit.options.allowUncategorized) {
return Category.findUncategorized();
} else {
const defaultCategoryId = parseInt(
@@ -94,6 +92,7 @@ export default ComboBoxComponent.extend({
search(filter) {
if (this.site.lazy_load_categories) {
return Category.asyncSearch(this._normalize(filter), {
+ includeUncategorized: this.allowUncategorizedTopics,
scopedCategoryId: this.selectKit.options?.scopedCategoryId,
prioritizedCategoryId: this.selectKit.options?.prioritizedCategoryId,
});
diff --git a/app/assets/javascripts/select-kit/addon/components/category-drop.js b/app/assets/javascripts/select-kit/addon/components/category-drop.js
index 8e4ffe4ad44..d39f8181254 100644
--- a/app/assets/javascripts/select-kit/addon/components/category-drop.js
+++ b/app/assets/javascripts/select-kit/addon/components/category-drop.js
@@ -24,6 +24,7 @@ export default ComboBoxComponent.extend({
navigateToEdit: false,
editingCategory: false,
editingCategoryTab: null,
+ allowUncategorizedTopics: setting("allow_uncategorized_topics"),
selectKitOptions: {
filterable: true,
@@ -40,7 +41,7 @@ export default ComboBoxComponent.extend({
displayCategoryDescription: "displayCategoryDescription",
headerComponent: "category-drop/category-drop-header",
parentCategory: false,
- allowUncategorized: setting("allow_uncategorized_topics"),
+ allowUncategorized: "allowUncategorizedTopics",
},
modifyComponentForRow() {