DEV: Remove unnecessary setupController methods (#29592)

and call super instead of manually setting model
This commit is contained in:
Jarek Radosz 2024-11-05 13:17:32 +01:00 committed by GitHub
parent 54e7dee6d7
commit cbfd596b1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 12 additions and 48 deletions

View File

@ -18,8 +18,8 @@ export default class AdminCustomizeColorsShowRoute extends Route {
return { scheme_id: model.get("id") };
}
setupController(controller, model) {
controller.set("model", model);
setupController(controller) {
super.setupController(...arguments);
controller.set("allColors", this.modelFor("adminCustomize.colors"));
}
}

View File

@ -5,8 +5,4 @@ export default class AdminCustomizeColorsRoute extends Route {
model() {
return ColorScheme.findAll();
}
setupController(controller, model) {
controller.set("model", model);
}
}

View File

@ -5,8 +5,4 @@ export default class AdminCustomizeFormTemplatesEdit extends DiscourseRoute {
model(params) {
return FormTemplate.findById(params.id);
}
setupController(controller, model) {
controller.set("model", model);
}
}

View File

@ -7,10 +7,6 @@ export default class AdminCustomizeFormTemplatesIndex extends DiscourseRoute {
return FormTemplate.findAll();
}
setupController(controller, model) {
controller.set("model", model);
}
@action
reloadModel() {
this.refresh();

View File

@ -6,8 +6,8 @@ export default class AdminEmailIncomingsRoute extends DiscourseRoute {
return IncomingEmail.findAll({ status: this.status });
}
setupController(controller, model) {
controller.set("model", model);
setupController(controller) {
super.setupController(...arguments);
controller.set("filter.status", this.status);
}
}

View File

@ -5,8 +5,4 @@ export default class AdminPermalinksRoute extends DiscourseRoute {
model() {
return Permalink.findAll();
}
setupController(controller, model) {
controller.set("model", model);
}
}

View File

@ -8,7 +8,9 @@ export default class AdminUserBadgesRoute extends DiscourseRoute {
return UserBadge.findByUsername(username);
}
setupController(controller, model) {
setupController(controller) {
super.setupController(...arguments);
// Find all badges.
controller.set("loading", true);
Badge.findAll().then(function (badges) {
@ -21,7 +23,5 @@ export default class AdminUserBadgesRoute extends DiscourseRoute {
}
controller.set("loading", false);
});
// Set the model.
controller.set("model", model);
}
}

View File

@ -57,8 +57,8 @@ export default class BadgesShow extends DiscourseRoute {
}
}
setupController(controller, model) {
controller.set("model", model);
setupController(controller) {
super.setupController(...arguments);
controller.set("userBadges", this.userBadgesGrant);
controller.set("userBadgesAll", this.userBadgesAll);
}

View File

@ -12,8 +12,4 @@ export default class Group extends DiscourseRoute {
serialize(model) {
return { name: model.get("name").toLowerCase() };
}
setupController(controller, model) {
controller.set("model", model);
}
}

View File

@ -18,10 +18,6 @@ export default class GroupsNew extends DiscourseRoute {
});
}
setupController(controller, model) {
controller.set("model", model);
}
afterModel() {
if (!this.get("currentUser.can_create_group")) {
this.router.transitionTo("groups");

View File

@ -28,8 +28,8 @@ export default class PasswordReset extends DiscourseRoute {
}
}
setupController(controller, model) {
controller.set("model", model);
setupController(controller) {
super.setupController(...arguments);
controller.initSelectedSecondFactorMethod();
}
}

View File

@ -1,7 +1,3 @@
import RestrictedUserRoute from "discourse/routes/restricted-user";
export default class PreferencesProfile extends RestrictedUserRoute {
setupController(controller, model) {
controller.set("model", model);
}
}
export default class PreferencesProfile extends RestrictedUserRoute {}

View File

@ -4,8 +4,4 @@ export default class extends DiscourseRoute {
model() {
return this.modelFor("user");
}
setupController(controller, model) {
controller.set("model", model);
}
}

View File

@ -11,10 +11,6 @@ export default class UserPrivateMessages extends DiscourseRoute {
this.pmTopicTrackingState.startTracking();
}
setupController() {
super.setupController(...arguments);
}
@action
triggerRefresh() {
this.refresh();