mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 23:32:44 +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) {
|
async search(filter) {
|
||||||
const opts = {
|
|
||||||
parentCategoryId: this.options.parentCategory?.id || -1,
|
|
||||||
includeUncategorized: this.siteSettings.allow_uncategorized_topics,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (this.siteSettings.lazy_load_categories) {
|
if (this.siteSettings.lazy_load_categories) {
|
||||||
const results = await Category.asyncSearch(filter, {
|
const results = await Category.asyncSearch(filter, {
|
||||||
...opts,
|
parentCategoryId: this.options.parentCategory?.id || -1,
|
||||||
|
includeUncategorized: this.siteSettings.allow_uncategorized_topics,
|
||||||
limit: 15,
|
limit: 15,
|
||||||
});
|
});
|
||||||
return this.shortcuts.concat(
|
return this.shortcuts.concat(
|
||||||
|
@ -157,6 +153,10 @@ export default ComboBoxComponent.extend({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const opts = {
|
||||||
|
parentCategoryId: this.options.parentCategory?.id,
|
||||||
|
};
|
||||||
|
|
||||||
if (filter) {
|
if (filter) {
|
||||||
let results = Category.search(filter, opts);
|
let results = Category.search(filter, opts);
|
||||||
return this._filterUncategorized(results).sort((a, b) => {
|
return this._filterUncategorized(results).sort((a, b) => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user