Skip to content

Commit

Permalink
DEV: Update modifyClass calls to native class syntax (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaylorhq authored Dec 2, 2024
1 parent 872dddd commit a6faed4
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions assets/javascripts/discourse/initializers/init-code-review.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import DiscourseURL, { userPath } from "discourse/lib/url";
import { findAll } from "discourse/models/login-method";
import I18n from "I18n";

const PLUGIN_ID = "discourse-code-review";

async function actOnCommit(topic, action) {
try {
let result = await ajax(`/code-review/${action}.json`, {
Expand Down Expand Up @@ -37,22 +35,27 @@ function initialize(api) {
//
// note there are slightly cleaner ways of doing this but we would need
// to amend core for the plugin which is not feeling right
api.modifyClass("controller:preferences/account", {
pluginId: PLUGIN_ID,

canUpdateAssociatedAccounts: computed("authProviders", function () {
return findAll().length > 0;
}),
});

api.modifyClass("controller:preferences/notifications", {
pluginId: PLUGIN_ID,

init() {
this._super(...arguments);
this.saveAttrNames.push("custom_fields");
},
});
api.modifyClass(
"controller:preferences/account",
(Superclass) =>
class extends Superclass {
@computed("authProviders")
get canUpdateAssociatedAccounts() {
return findAll().length > 0;
}
}
);

api.modifyClass(
"controller:preferences/notifications",
(Superclass) =>
class extends Superclass {
init() {
super.init(...arguments);
this.saveAttrNames.push("custom_fields");
}
}
);

function allowSkip(currentUser, topic, siteSettings) {
return allowApprove(currentUser, topic, siteSettings);
Expand Down

0 comments on commit a6faed4

Please sign in to comment.