DEV: Resolve transitionTo deprecation (#268)

This commit is contained in:
David Taylor 2023-12-01 16:02:52 +00:00 committed by GitHub
parent e067df0b43
commit a6341627d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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);
});
}