11import Component from " @glimmer/component" ;
22import { tracked } from " @glimmer/tracking" ;
33import { service } from " @ember/service" ;
4+ import TopicLink from " discourse/components/topic-list/topic-link" ;
45import categoryLink from " discourse/helpers/category-link" ;
5- import htmlSafe from " discourse/helpers/html-safe" ;
6- import replaceEmoji from " discourse/helpers/replace-emoji" ;
7- import getURL from " discourse/lib/get-url" ;
86import Category from " discourse/models/category" ;
97
108export default class CategoryTopics extends Component {
@@ -26,16 +24,7 @@ export default class CategoryTopics extends Component {
2624 this .category = Category .findById (categoryId);
2725
2826 this .store .findFiltered (" topicList" , { filter }).then ((result ) => {
29- const results = result .topic_list .topics ;
30-
31- results .forEach ((topic ) => {
32- topic .url = ` ${ getURL (" /t/" )}${ topic .slug } /${ topic .id } ` ;
33- if (topic .last_read_post_number > 0 ) {
34- topic .url += ` /${ topic .last_read_post_number } ` ;
35- }
36- });
37-
38- this .topics = results .slice (0 , count);
27+ this .topics = result .topics .slice (0 , count);
3928 });
4029 }
4130
@@ -49,12 +38,11 @@ export default class CategoryTopics extends Component {
4938
5039 <div class =" category-topics--content" >
5140 {{#each this . topics as | topic | }}
52- <a href ={{topic.url }} class =" category-topics--topic" >
53- {{htmlSafe ( replaceEmoji topic.fancy_title ) }}
41+ <TopicLink @ topic ={{topic }} class =" category-topics--topic" >
5442 <span class =" category-topics--posts-count" >
5543 ({{topic.posts_count }} )
5644 </span >
57- </a >
45+ </TopicLink >
5846 {{/each }}
5947 </div >
6048 </template >
0 commit comments