Skip to content

Commit

Permalink
DEV: Resolve transitionTo deprecation (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaylorhq authored Dec 1, 2023
1 parent e067df0 commit a634162
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default class PluginsExplorerController extends Controller {
@service("router") router;
@service dialog;
@service appEvents;
@service router;

Check failure on line 19 in assets/javascripts/discourse/controllers/admin-plugins-explorer.js

View workflow job for this annotation

GitHub Actions / ci / linting

Duplicate name 'router'

@tracked sortByProperty = "last_run_at";
@tracked sortDescending = true;
Expand Down
7 changes: 5 additions & 2 deletions assets/javascripts/discourse/routes/group-reports-index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { ajax } from "discourse/lib/ajax";

Check failure on line 1 in assets/javascripts/discourse/routes/group-reports-index.js

View workflow job for this annotation

GitHub Actions / ci / linting

Run autofix to sort these imports!
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`)
Expand All @@ -11,15 +14,15 @@ export default class GroupReportsIndexRoute extends DiscourseRoute {
group,
};
})
.catch(() => this.transitionTo("group.members", group));
.catch(() => this.router.transitionTo("group.members", group));
}

afterModel(model) {
if (
!model.group.get("is_group_user") &&
!(this.currentUser && this.currentUser.admin)
) {
this.transitionTo("group.members", model.group);
this.router.transitionTo("group.members", model.group);
}
}

Expand Down
5 changes: 4 additions & 1 deletion assets/javascripts/discourse/routes/group-reports-show.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { ajax } from "discourse/lib/ajax";

Check failure on line 1 in assets/javascripts/discourse/routes/group-reports-show.js

View workflow job for this annotation

GitHub Actions / ci / linting

Run autofix to sort these imports!
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}`)
Expand All @@ -24,7 +27,7 @@ export default class GroupReportsShowRoute extends DiscourseRoute {
};
})
.catch(() => {
this.transitionTo("group.members", group);
this.router.transitionTo("group.members", group);
});
}

Expand Down

0 comments on commit a634162

Please sign in to comment.