diff --git a/app/assets/javascripts/select-kit/components/category-chooser.js.es6 b/app/assets/javascripts/select-kit/components/category-chooser.js.es6 index 5cc57a7f6c..87dcf59afe 100644 --- a/app/assets/javascripts/select-kit/components/category-chooser.js.es6 +++ b/app/assets/javascripts/select-kit/components/category-chooser.js.es6 @@ -30,6 +30,12 @@ export default ComboBoxComponent.extend({ return computedContent; } + if (this.get("scopedCategoryId")) { + computedContent = this.categoriesByScope().map(c => + this.computeContentItem(c) + ); + } + const _matchFunction = (f, text) => { return this._normalize(text).indexOf(f) > -1; }; @@ -111,11 +117,14 @@ export default ComboBoxComponent.extend({ }, computeContent() { + return this.categoriesByScope(this.get("scopedCategoryId")); + }, + + categoriesByScope(scopedCategoryId = null) { const categories = Discourse.SiteSettings.fixed_category_positions_on_create ? Category.list() : Category.listByActivity(); - let scopedCategoryId = this.get("scopedCategoryId"); if (scopedCategoryId) { const scopedCat = Category.findById(scopedCategoryId); scopedCategoryId = diff --git a/test/javascripts/components/category-chooser-test.js.es6 b/test/javascripts/components/category-chooser-test.js.es6 index 271b00aa69..ba02fb51a0 100644 --- a/test/javascripts/components/category-chooser-test.js.es6 +++ b/test/javascripts/components/category-chooser-test.js.es6 @@ -71,6 +71,10 @@ componentTest("with scopedCategoryId", { 26 ); assert.equal(this.get("subject").rows().length, 2); + + await this.get("subject").fillInFilter("dev"); + + assert.equal(this.get("subject").rows().length, 3); } });