mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 17:13:43 +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") };
|
return { scheme_id: model.get("id") };
|
||||||
}
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller) {
|
||||||
controller.set("model", model);
|
super.setupController(...arguments);
|
||||||
controller.set("allColors", this.modelFor("adminCustomize.colors"));
|
controller.set("allColors", this.modelFor("adminCustomize.colors"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,4 @@ export default class AdminCustomizeColorsRoute extends Route {
|
||||||
model() {
|
model() {
|
||||||
return ColorScheme.findAll();
|
return ColorScheme.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
|
||||||
controller.set("model", model);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,4 @@ export default class AdminCustomizeFormTemplatesEdit extends DiscourseRoute {
|
||||||
model(params) {
|
model(params) {
|
||||||
return FormTemplate.findById(params.id);
|
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();
|
return FormTemplate.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
|
||||||
controller.set("model", model);
|
|
||||||
}
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
reloadModel() {
|
reloadModel() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
|
|
@ -6,8 +6,8 @@ export default class AdminEmailIncomingsRoute extends DiscourseRoute {
|
||||||
return IncomingEmail.findAll({ status: this.status });
|
return IncomingEmail.findAll({ status: this.status });
|
||||||
}
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller) {
|
||||||
controller.set("model", model);
|
super.setupController(...arguments);
|
||||||
controller.set("filter.status", this.status);
|
controller.set("filter.status", this.status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,4 @@ export default class AdminPermalinksRoute extends DiscourseRoute {
|
||||||
model() {
|
model() {
|
||||||
return Permalink.findAll();
|
return Permalink.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
|
||||||
controller.set("model", model);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,9 @@ export default class AdminUserBadgesRoute extends DiscourseRoute {
|
||||||
return UserBadge.findByUsername(username);
|
return UserBadge.findByUsername(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller) {
|
||||||
|
super.setupController(...arguments);
|
||||||
|
|
||||||
// Find all badges.
|
// Find all badges.
|
||||||
controller.set("loading", true);
|
controller.set("loading", true);
|
||||||
Badge.findAll().then(function (badges) {
|
Badge.findAll().then(function (badges) {
|
||||||
|
@ -21,7 +23,5 @@ export default class AdminUserBadgesRoute extends DiscourseRoute {
|
||||||
}
|
}
|
||||||
controller.set("loading", false);
|
controller.set("loading", false);
|
||||||
});
|
});
|
||||||
// Set the model.
|
|
||||||
controller.set("model", model);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,8 +57,8 @@ export default class BadgesShow extends DiscourseRoute {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller) {
|
||||||
controller.set("model", model);
|
super.setupController(...arguments);
|
||||||
controller.set("userBadges", this.userBadgesGrant);
|
controller.set("userBadges", this.userBadgesGrant);
|
||||||
controller.set("userBadgesAll", this.userBadgesAll);
|
controller.set("userBadgesAll", this.userBadgesAll);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,4 @@ export default class Group extends DiscourseRoute {
|
||||||
serialize(model) {
|
serialize(model) {
|
||||||
return { name: model.get("name").toLowerCase() };
|
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() {
|
afterModel() {
|
||||||
if (!this.get("currentUser.can_create_group")) {
|
if (!this.get("currentUser.can_create_group")) {
|
||||||
this.router.transitionTo("groups");
|
this.router.transitionTo("groups");
|
||||||
|
|
|
@ -28,8 +28,8 @@ export default class PasswordReset extends DiscourseRoute {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller) {
|
||||||
controller.set("model", model);
|
super.setupController(...arguments);
|
||||||
controller.initSelectedSecondFactorMethod();
|
controller.initSelectedSecondFactorMethod();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
export default class PreferencesProfile extends RestrictedUserRoute {
|
export default class PreferencesProfile extends RestrictedUserRoute {}
|
||||||
setupController(controller, model) {
|
|
||||||
controller.set("model", model);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,8 +4,4 @@ export default class extends DiscourseRoute {
|
||||||
model() {
|
model() {
|
||||||
return this.modelFor("user");
|
return this.modelFor("user");
|
||||||
}
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
|
||||||
controller.set("model", model);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,6 @@ export default class UserPrivateMessages extends DiscourseRoute {
|
||||||
this.pmTopicTrackingState.startTracking();
|
this.pmTopicTrackingState.startTracking();
|
||||||
}
|
}
|
||||||
|
|
||||||
setupController() {
|
|
||||||
super.setupController(...arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
triggerRefresh() {
|
triggerRefresh() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user