Skip to content

Commit 90540aa

Browse files
committed
COMPATIBILITY: component modification has to happen in an initializer
1 parent e5178c3 commit 90540aa

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

desktop/header.html

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,6 @@
8989
{{raw "topic-list-header-column" sortable='true' number='true' order='posts' forceName='Replies'}}
9090
</script>
9191

92-
<script>
93-
94-
(function(){
95-
var TopicListItemView = require('discourse/components/topic-list-item').default;
96-
TopicListItemView.reopen({
97-
showCategory: function(){
98-
return !this.get('controller.hideCategory') &&
99-
this.get('topic.creator') &&
100-
this.get('topic.category.name') !== 'uncategorized';
101-
}.property()
102-
});
103-
})();
104-
105-
</script>
106-
10792
<script type="text/x-handlebars" data-template-name="components/latest-topic-list-item">
10893
<!--
10994
<div class='topic-poster'>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { withPluginApi } from "discourse/lib/plugin-api";
2+
import discourseComputed from "discourse-common/utils/decorators";
3+
4+
function initializePlugin(api) {
5+
api.modifyClass("component:topic-list-item", {
6+
pluginId: "acescentral",
7+
8+
@discourseComputed('hideCategory', 'topic.category.name')
9+
showCategory(hideCategory, categoryName){
10+
return !hideCategory && categoryName !== 'uncategorized';
11+
}
12+
});
13+
}
14+
15+
export default {
16+
name: "acescentral",
17+
18+
initialize() {
19+
withPluginApi("1.24.0", initializePlugin);
20+
},
21+
};

0 commit comments

Comments
 (0)