mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 02:32:45 +08:00
UX: search all categories even if category-chooser is scoped to particular category
This commit is contained in:
parent
978cc0cfca
commit
a8ff4a8a78
|
@ -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 =
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user