UX: search all categories even if category-chooser is scoped to particular category

UX: search all categories even if category-chooser is scoped to particular category

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 5cc57a7..87dcf59 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 271b00a..ba02fb5 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);
   }
 });

GitHub sha: a8ff4a8a

This commit has been mentioned on Discourse Meta. There might be relevant details there:

This commit has been mentioned on Discourse Meta. There might be relevant details there:

This commit has been mentioned on Discourse Meta. There might be relevant details there: