Skip to content

Commit f52ce6b

Browse files
DEV: Upgrade modifyClass syntax to remove object-literal decorators (#79)
Decorators on object literal properties are unsupported in most modern JS tooling, including ts/glint and Prettier 3.0. Using the new native-class-based modifyClass syntax means we can use decorators safely
1 parent 18507a4 commit f52ce6b

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

javascripts/discourse/initializers/initialize-discourse-kanban.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,25 @@ export default {
2424
refreshModel: true,
2525
});
2626

27-
api.modifyClass("component:navigation-item", {
28-
pluginId: PLUGIN_ID,
27+
api.modifyClass(
28+
"component:navigation-item",
29+
(Superclass) =>
30+
class extends Superclass {
31+
@service kanbanManager;
2932

30-
kanbanManager: service(),
31-
@discourseComputed(
32-
"content.filterMode",
33-
"filterMode",
34-
"kanbanManager.active"
35-
)
36-
active(contentFilterMode, filterMode, active) {
37-
if (active) {
38-
return false;
33+
@discourseComputed(
34+
"content.filterMode",
35+
"filterMode",
36+
"kanbanManager.active"
37+
)
38+
active(contentFilterMode, filterMode, active) {
39+
if (active) {
40+
return false;
41+
}
42+
return super.active;
43+
}
3944
}
40-
return this._super(contentFilterMode, filterMode);
41-
},
42-
});
45+
);
4346

4447
const routeToBoard = (transition, categorySlug) => {
4548
return (

0 commit comments

Comments
 (0)