Skip to content

Commit a76e5cd

Browse files
committed
DEV: Update modifyClass clickCreateTopicButton
1 parent f594602 commit a76e5cd

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

assets/javascripts/discourse/initializers/custom-wizard-edits.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { action } from "@ember/object";
12
import { ajax } from "discourse/lib/ajax";
23
import { popupAjaxError } from "discourse/lib/ajax-error";
34
import { withPluginApi } from "discourse/lib/plugin-api";
@@ -23,21 +24,23 @@ export default {
2324
};
2425

2526
withPluginApi("0.8.36", (api) => {
26-
api.modifyClass("component:d-navigation", {
27-
pluginId: "custom-wizard",
28-
actions: {
29-
clickCreateTopicButton() {
30-
let createTopicWizard = this.get(
31-
"category.custom_fields.create_topic_wizard"
32-
);
33-
if (createTopicWizard) {
34-
window.location.href = getUrl(`/w/${createTopicWizard}`);
35-
} else {
36-
this._super();
37-
}
38-
},
39-
},
40-
});
27+
api.modifyClass(
28+
"component:d-navigation",
29+
(Superclass) =>
30+
class extends Superclass {
31+
@action
32+
clickCreateTopicButton() {
33+
let createTopicWizard = this.get(
34+
"category.custom_fields.create_topic_wizard"
35+
);
36+
if (createTopicWizard) {
37+
window.location.href = getUrl(`/w/${createTopicWizard}`);
38+
} else {
39+
super.clickCreateTopicButton();
40+
}
41+
}
42+
}
43+
);
4144

4245
api.modifyClass("component:d-editor", {
4346
pluginId: "custom-wizard",

0 commit comments

Comments
 (0)