mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 05:59:39 +08:00
FIX: category-selector for top level categories (#24627)
The filter for top-level categories by using parent_category_id = -1 is
only implemented by the new search API.
Follow up to commit dbb8b66a37
.
This commit is contained in:
parent
d38360b23f
commit
1881ae50be
|
@ -134,14 +134,10 @@ export default ComboBoxComponent.extend({
|
|||
),
|
||||
|
||||
async search(filter) {
|
||||
const opts = {
|
||||
parentCategoryId: this.options.parentCategory?.id || -1,
|
||||
includeUncategorized: this.siteSettings.allow_uncategorized_topics,
|
||||
};
|
||||
|
||||
if (this.siteSettings.lazy_load_categories) {
|
||||
const results = await Category.asyncSearch(filter, {
|
||||
...opts,
|
||||
parentCategoryId: this.options.parentCategory?.id || -1,
|
||||
includeUncategorized: this.siteSettings.allow_uncategorized_topics,
|
||||
limit: 15,
|
||||
});
|
||||
return this.shortcuts.concat(
|
||||
|
@ -157,6 +153,10 @@ export default ComboBoxComponent.extend({
|
|||
);
|
||||
}
|
||||
|
||||
const opts = {
|
||||
parentCategoryId: this.options.parentCategory?.id,
|
||||
};
|
||||
|
||||
if (filter) {
|
||||
let results = Category.search(filter, opts);
|
||||
return this._filterUncategorized(results).sort((a, b) => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user