mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 01:53:39 +08:00
DEV: Remove unnecessary setupController methods (#29592)
and call super instead of manually setting model
This commit is contained in:
parent
54e7dee6d7
commit
cbfd596b1b
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,4 @@ export default class AdminCustomizeColorsRoute extends Route {
|
|||
model() {
|
||||
return ColorScheme.findAll();
|
||||
}
|
||||
|
||||
setupController(controller, model) {
|
||||
controller.set("model", model);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,4 @@ export default class AdminCustomizeFormTemplatesEdit extends DiscourseRoute {
|
|||
model(params) {
|
||||
return FormTemplate.findById(params.id);
|
||||
}
|
||||
|
||||
setupController(controller, model) {
|
||||
controller.set("model", model);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,10 +7,6 @@ export default class AdminCustomizeFormTemplatesIndex extends DiscourseRoute {
|
|||
return FormTemplate.findAll();
|
||||
}
|
||||
|
||||
setupController(controller, model) {
|
||||
controller.set("model", model);
|
||||
}
|
||||
|
||||
@action
|
||||
reloadModel() {
|
||||
this.refresh();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,4 @@ export default class AdminPermalinksRoute extends DiscourseRoute {
|
|||
model() {
|
||||
return Permalink.findAll();
|
||||
}
|
||||
|
||||
setupController(controller, model) {
|
||||
controller.set("model", model);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -28,8 +28,8 @@ export default class PasswordReset extends DiscourseRoute {
|
|||
}
|
||||
}
|
||||
|
||||
setupController(controller, model) {
|
||||
controller.set("model", model);
|
||||
setupController(controller) {
|
||||
super.setupController(...arguments);
|
||||
controller.initSelectedSecondFactorMethod();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {}
|
||||
|
|
|
@ -4,8 +4,4 @@ export default class extends DiscourseRoute {
|
|||
model() {
|
||||
return this.modelFor("user");
|
||||
}
|
||||
|
||||
setupController(controller, model) {
|
||||
controller.set("model", model);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,10 +11,6 @@ export default class UserPrivateMessages extends DiscourseRoute {
|
|||
this.pmTopicTrackingState.startTracking();
|
||||
}
|
||||
|
||||
setupController() {
|
||||
super.setupController(...arguments);
|
||||
}
|
||||
|
||||
@action
|
||||
triggerRefresh() {
|
||||
this.refresh();
|
||||
|
|
Loading…
Reference in New Issue
Block a user