mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 01:57:15 +08:00
DEV: Upgrade replaceRoute
on Controller (#22648)
Per https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods We are upgrading all `this.replaceRoute` calls on controllers to directly call the router service (`this.router.replaceRoute`)
This commit is contained in:
@ -3,8 +3,11 @@ import Controller from "@ember/controller";
|
||||
import I18n from "I18n";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { url } from "discourse/lib/computed";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
||||
export default class AdminCustomizeThemesEditController extends Controller {
|
||||
@service router;
|
||||
|
||||
section = null;
|
||||
currentTarget = 0;
|
||||
maximized = false;
|
||||
@ -48,7 +51,12 @@ export default class AdminCustomizeThemesEditController extends Controller {
|
||||
|
||||
@action
|
||||
fieldAdded(target, name) {
|
||||
this.replaceRoute(this.editRouteName, this.get("model.id"), target, name);
|
||||
this.router.replaceRoute(
|
||||
this.editRouteName,
|
||||
this.get("model.id"),
|
||||
target,
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
@action
|
||||
@ -60,7 +68,7 @@ export default class AdminCustomizeThemesEditController extends Controller {
|
||||
(f) => f.edited
|
||||
);
|
||||
|
||||
this.replaceRoute(
|
||||
this.router.replaceRoute(
|
||||
this.editRouteName,
|
||||
this.get("model.id"),
|
||||
firstTarget.name,
|
||||
@ -72,6 +80,6 @@ export default class AdminCustomizeThemesEditController extends Controller {
|
||||
|
||||
@action
|
||||
goBack() {
|
||||
this.replaceRoute(this.showRouteName, this.model.id);
|
||||
this.router.replaceRoute(this.showRouteName, this.model.id);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user