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

This commit is contained in:
Vinoth Kannan 2019-01-10 21:19:53 +05:30
parent 978cc0cfca
commit a8ff4a8a78
2 changed files with 14 additions and 1 deletions

View File

@ -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 =

View File

@ -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);
}
});