From 29c9d8a133858836162a97d7516fb300485a2816 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Fri, 6 Mar 2020 20:11:21 +0100 Subject: [PATCH] FIX: uses only global allow_uncategorized_topics for category drop (#9130) --- .../select-kit/components/category-drop.js.es6 | 8 ++------ .../components/select-kit/category-drop-test.js.es6 | 8 +++++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/select-kit/components/category-drop.js.es6 b/app/assets/javascripts/select-kit/components/category-drop.js.es6 index 5ee9a6d12b9..c80f46bea96 100644 --- a/app/assets/javascripts/select-kit/components/category-drop.js.es6 +++ b/app/assets/javascripts/select-kit/components/category-drop.js.es6 @@ -28,7 +28,6 @@ export default ComboBoxComponent.extend({ subCategory: false, clearable: false, hideParentCategory: "hideParentCategory", - allowUncategorized: true, countSubcategories: false, autoInsertNoneItem: false, displayCategoryDescription: "displayCategoryDescription", @@ -96,7 +95,7 @@ export default ComboBoxComponent.extend({ content.title = category.title; content.label = categoryBadgeHTML(category, { link: false, - allowUncategorized: this.selectKit.options.allowUncategorized, + allowUncategorized: true, hideParent: true }).htmlSafe(); } @@ -174,10 +173,7 @@ export default ComboBoxComponent.extend({ }, _filterUncategorized(content) { - if ( - !this.siteSettings.allow_uncategorized_topics || - !this.selectKit.options.allowUncategorized - ) { + if (!this.siteSettings.allow_uncategorized_topics) { content = content.filter( c => c.id !== this.site.uncategorized_category_id ); diff --git a/test/javascripts/components/select-kit/category-drop-test.js.es6 b/test/javascripts/components/select-kit/category-drop-test.js.es6 index 2a3b7b6e562..5c45042cb93 100644 --- a/test/javascripts/components/select-kit/category-drop-test.js.es6 +++ b/test/javascripts/components/select-kit/category-drop-test.js.es6 @@ -187,10 +187,11 @@ componentTest("hideParentCategory (true)", { } }); -componentTest("allowUncategorized (default: true)", { +componentTest("allow_uncategorized_topics (true)", { template: template(), beforeEach() { + this.siteSettings.allow_uncategorized_topics = true; initCategories(this); }, @@ -203,10 +204,11 @@ componentTest("allowUncategorized (default: true)", { } }); -componentTest("allowUncategorized (false)", { - template: template(["allowUncategorized=false"]), +componentTest("allow_uncategorized_topics (false)", { + template: template(), beforeEach() { + this.siteSettings.allow_uncategorized_topics = false; initCategories(this); },