mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 11:23:43 +08:00
011ba5b9f6
Per https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods We are upgrading all `this.transitionTo` calls on routes to directly call the router service (`this.router.transitionTo`)
30 lines
706 B
JavaScript
30 lines
706 B
JavaScript
import Route from "@ember/routing/route";
|
|
import { action } from "@ember/object";
|
|
import { inject as service } from "@ember/service";
|
|
|
|
export default class AdminCustomizeEmailTemplatesRoute extends Route {
|
|
@service router;
|
|
|
|
model() {
|
|
return this.store.findAll("email-template");
|
|
}
|
|
|
|
setupController(controller, model) {
|
|
controller.set("emailTemplates", model);
|
|
}
|
|
|
|
@action
|
|
didTransition() {
|
|
const editController = this.controllerFor(
|
|
"adminCustomizeEmailTemplates.edit"
|
|
);
|
|
|
|
if (!editController.emailTemplate) {
|
|
this.router.transitionTo(
|
|
"adminCustomizeEmailTemplates.edit",
|
|
this.controller.get("sortedTemplates.firstObject")
|
|
);
|
|
}
|
|
}
|
|
}
|