mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 14:22:52 +08:00
FIX: Show category list on subcategory page if it has subcategories too (#8768)
The category list was displayed only for top level categories, which had no parent.
This commit is contained in:
parent
b63d146128
commit
c7a8bbd6a5
|
@ -13,7 +13,10 @@ export function addCategorySortCriteria(criteria) {
|
|||
export default buildCategoryPanel("settings", {
|
||||
emailInEnabled: setting("email_in"),
|
||||
showPositionInput: setting("fixed_category_positions"),
|
||||
isParentCategory: empty("category.parent_category_id"),
|
||||
@discourseComputed("category.isParent", "category.parent_category_id")
|
||||
isParentCategory(isParent, parentCategoryId) {
|
||||
return isParent || !parentCategoryId;
|
||||
},
|
||||
showSubcategoryListStyle: and(
|
||||
"category.show_subcategory_list",
|
||||
"isParentCategory"
|
||||
|
|
|
@ -65,6 +65,11 @@ const Category = RestModel.extend({
|
|||
return (parentLevel || -1) + 1;
|
||||
},
|
||||
|
||||
@discourseComputed("subcategories")
|
||||
isParent(subcategories) {
|
||||
return subcategories && subcategories.length > 0;
|
||||
},
|
||||
|
||||
@discourseComputed("subcategories")
|
||||
isGrandParent(subcategories) {
|
||||
return (
|
||||
|
|
|
@ -9,7 +9,6 @@ import PermissionType from "discourse/models/permission-type";
|
|||
import CategoryList from "discourse/models/category-list";
|
||||
import Category from "discourse/models/category";
|
||||
import { Promise, all } from "rsvp";
|
||||
import { isNone } from "@ember/utils";
|
||||
|
||||
// A helper function to create a category route with parameters
|
||||
export default (filterArg, params) => {
|
||||
|
@ -88,10 +87,8 @@ export default (filterArg, params) => {
|
|||
|
||||
_createSubcategoryList(category) {
|
||||
this._categoryList = null;
|
||||
if (
|
||||
isNone(category.get("parentCategory")) &&
|
||||
category.get("show_subcategory_list")
|
||||
) {
|
||||
|
||||
if (category.isParent && category.show_subcategory_list) {
|
||||
return CategoryList.listForParent(this.store, category).then(
|
||||
list => (this._categoryList = list)
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue
Block a user