FIX: Use serialized subcategories in subcategory-with-featured-topics (#26718)
This commit is contained in:
parent
859b55366f
commit
d2a52c3c35
|
@ -13,7 +13,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody aria-labelledby="categories-only-category">
|
||||
{{#each category.subcategories as |subCategory|}}
|
||||
{{#each category.serializedSubcategories as |subCategory|}}
|
||||
<ParentCategoryRow @category={{subCategory}} @showTopics={{true}} />
|
||||
{{else}}
|
||||
{{! No subcategories... so just show the parent to avoid confusion }}
|
||||
|
|
|
@ -6,6 +6,7 @@ import { NotificationLevels } from "discourse/lib/notification-levels";
|
|||
import PermissionType from "discourse/models/permission-type";
|
||||
import RestModel from "discourse/models/rest";
|
||||
import Site from "discourse/models/site";
|
||||
import Topic from "discourse/models/topic";
|
||||
import User from "discourse/models/user";
|
||||
import { getOwnerWithFallback } from "discourse-common/lib/get-owner";
|
||||
import getURL from "discourse-common/lib/get-url";
|
||||
|
@ -459,6 +460,11 @@ export default class Category extends RestModel {
|
|||
return this.site.categories.filterBy("parent_category_id", this.id);
|
||||
}
|
||||
|
||||
@computed("subcategory_list")
|
||||
get serializedSubcategories() {
|
||||
return this.subcategory_list?.map((c) => Category.create(c));
|
||||
}
|
||||
|
||||
@discourseComputed("required_tag_groups", "minimum_required_tags")
|
||||
minimumRequiredTags() {
|
||||
if (this.required_tag_groups?.length > 0) {
|
||||
|
@ -759,7 +765,9 @@ export default class Category extends RestModel {
|
|||
@discourseComputed("topics")
|
||||
featuredTopics(topics) {
|
||||
if (topics && topics.length) {
|
||||
return topics.slice(0, this.num_featured_topics || 2);
|
||||
return topics
|
||||
.slice(0, this.num_featured_topics || 2)
|
||||
.map((t) => Topic.create(t));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1554,6 +1554,27 @@ export default {
|
|||
description_excerpt:
|
||||
"Discussion about features or potential features of Discourse: how they work, why they work, etc.",
|
||||
featured_user_ids: [1917, 4385, 2072, 32, 4263],
|
||||
subcategory_list: [
|
||||
{
|
||||
id: 26,
|
||||
name: "spec",
|
||||
color: "33B0B0",
|
||||
text_color: "FFFFFF",
|
||||
slug: "spec",
|
||||
topic_count: 20,
|
||||
post_count: 278,
|
||||
description:
|
||||
"My idea here is to have mini specs for features we would like built but have no bandwidth to build",
|
||||
description_text:
|
||||
"My idea here is to have mini specs for features we would like built but have no bandwidth to build",
|
||||
topic_url: "/t/about-the-spec-category/13965",
|
||||
read_restricted: false,
|
||||
permission: 1,
|
||||
parent_category_id: 2,
|
||||
notification_level: null,
|
||||
background_url: null,
|
||||
},
|
||||
],
|
||||
topics: [
|
||||
{
|
||||
id: 11997,
|
||||
|
|
Loading…
Reference in New Issue