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:
Isaac Janzen
2023-07-18 15:16:41 -05:00
committed by GitHub
parent 33db93c9b2
commit 72edb7270c
5 changed files with 26 additions and 8 deletions

View File

@ -8,6 +8,7 @@ import discourseComputed from "discourse-common/utils/decorators";
import getURL from "discourse-common/lib/get-url";
import { makeArray } from "discourse-common/lib/helpers";
import { setting } from "discourse/lib/computed";
import { inject as service } from "@ember/service";
function staticReport(reportType) {
return computed("reports.[]", function () {
@ -18,6 +19,8 @@ function staticReport(reportType) {
export default class AdminDashboardGeneralController extends Controller.extend(
PeriodComputationMixin
) {
@service router;
@service siteSettings;
@controller("exception") exceptionController;
isLoading = false;
@ -137,7 +140,7 @@ export default class AdminDashboardGeneralController extends Controller.extend(
})
.catch((e) => {
this.exceptionController.set("thrown", e.jqXHR);
this.replaceRoute("exception");
this.router.replaceRoute("exception");
})
.finally(() => this.set("isLoading", false));
}