From a6341627d0a23b189d8cd2d302f7683c3270cc91 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 1 Dec 2023 16:02:52 +0000 Subject: [PATCH] DEV: Resolve transitionTo deprecation (#268) --- .../discourse/controllers/admin-plugins-explorer.js | 1 + assets/javascripts/discourse/routes/group-reports-index.js | 7 +++++-- assets/javascripts/discourse/routes/group-reports-show.js | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/assets/javascripts/discourse/controllers/admin-plugins-explorer.js b/assets/javascripts/discourse/controllers/admin-plugins-explorer.js index 2207c57..da79afe 100644 --- a/assets/javascripts/discourse/controllers/admin-plugins-explorer.js +++ b/assets/javascripts/discourse/controllers/admin-plugins-explorer.js @@ -16,6 +16,7 @@ export default class PluginsExplorerController extends Controller { @service("router") router; @service dialog; @service appEvents; + @service router; @tracked sortByProperty = "last_run_at"; @tracked sortDescending = true; diff --git a/assets/javascripts/discourse/routes/group-reports-index.js b/assets/javascripts/discourse/routes/group-reports-index.js index 8b4d8a8..1aa3961 100644 --- a/assets/javascripts/discourse/routes/group-reports-index.js +++ b/assets/javascripts/discourse/routes/group-reports-index.js @@ -1,7 +1,10 @@ import { ajax } from "discourse/lib/ajax"; import DiscourseRoute from "discourse/routes/discourse"; +import { inject as service } from "@ember/service"; export default class GroupReportsIndexRoute extends DiscourseRoute { + @service router; + model() { const group = this.modelFor("group"); return ajax(`/g/${group.name}/reports`) @@ -11,7 +14,7 @@ export default class GroupReportsIndexRoute extends DiscourseRoute { group, }; }) - .catch(() => this.transitionTo("group.members", group)); + .catch(() => this.router.transitionTo("group.members", group)); } afterModel(model) { @@ -19,7 +22,7 @@ export default class GroupReportsIndexRoute extends DiscourseRoute { !model.group.get("is_group_user") && !(this.currentUser && this.currentUser.admin) ) { - this.transitionTo("group.members", model.group); + this.router.transitionTo("group.members", model.group); } } diff --git a/assets/javascripts/discourse/routes/group-reports-show.js b/assets/javascripts/discourse/routes/group-reports-show.js index 027e445..3b25b12 100644 --- a/assets/javascripts/discourse/routes/group-reports-show.js +++ b/assets/javascripts/discourse/routes/group-reports-show.js @@ -1,7 +1,10 @@ import { ajax } from "discourse/lib/ajax"; import DiscourseRoute from "discourse/routes/discourse"; +import { inject as service } from "@ember/service"; export default class GroupReportsShowRoute extends DiscourseRoute { + @service router; + model(params) { const group = this.modelFor("group"); return ajax(`/g/${group.name}/reports/${params.query_id}`) @@ -24,7 +27,7 @@ export default class GroupReportsShowRoute extends DiscourseRoute { }; }) .catch(() => { - this.transitionTo("group.members", group); + this.router.transitionTo("group.members", group); }); }