From 742239b0233b34ffc95d615fa34e163dac2e6046 Mon Sep 17 00:00:00 2001 From: merefield Date: Thu, 14 Sep 2023 14:58:34 +0100 Subject: [PATCH] add router service to controllers to avoid deprecation --- .../discourse/controllers/admin-wizards-api-show.js.es6 | 5 ++++- .../discourse/controllers/custom-wizard-step.js.es6 | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/assets/javascripts/discourse/controllers/admin-wizards-api-show.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-api-show.js.es6 index c08e820c..66b62da2 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-api-show.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-api-show.js.es6 @@ -7,8 +7,11 @@ import { selectKitContent } from "../lib/wizard"; import { underscore } from "@ember/string"; import Controller from "@ember/controller"; import I18n from "I18n"; +import { inject as service } from '@ember/service'; export default Controller.extend({ + router: service(), + queryParams: ["refresh_list"], loadingSubscriptions: false, notAuthorized: not("api.authorized"), @@ -248,7 +251,7 @@ export default Controller.extend({ .catch(popupAjaxError) .then((result) => { if (result.success) { - this.transitionToRoute("adminWizardsApis").then(() => { + this.router.transitionToRoute("adminWizardsApis").then(() => { this.send("refreshModel"); }); } diff --git a/assets/javascripts/discourse/controllers/custom-wizard-step.js.es6 b/assets/javascripts/discourse/controllers/custom-wizard-step.js.es6 index 2dca2e70..7efd9782 100644 --- a/assets/javascripts/discourse/controllers/custom-wizard-step.js.es6 +++ b/assets/javascripts/discourse/controllers/custom-wizard-step.js.es6 @@ -1,7 +1,9 @@ import Controller from "@ember/controller"; import getUrl from "discourse-common/lib/get-url"; +import { inject as service } from '@ember/service'; export default Controller.extend({ + router: service(), wizard: null, step: null, @@ -15,12 +17,12 @@ export default Controller.extend({ const wizardId = this.get("wizard.id"); window.location.href = getUrl(`/w/${wizardId}/steps/${nextStepId}`); } else { - this.transitionToRoute("customWizardStep", nextStepId); + this.router.transitionToRoute("customWizardStep", nextStepId); } }, goBack() { - this.transitionToRoute("customWizardStep", this.get("step.previous")); + this.router.transitionToRoute("customWizardStep", this.get("step.previous")); }, showMessage(message) {