discourse/app/assets/javascripts/admin/addon/routes/admin-users-list-show.js
Jarek Radosz c3fd91670e
DEV: Update linting setup and fix issues (#17345)
Re-lands #16119 and #17298

* Update eslint-config-discourse
* Update linting workflow
* Prettier-ignore stuff
* Update template-lint config
* Auto-fix template issues
* Fix various template issues
  Mostly incorrect attributes and unused templates
* Prettier js files
* Fix template auto-fix regressions
* Small css tweak

Co-authored-by: Peter Wagenet <peter.wagenet@gmail.com>
2022-07-06 10:37:54 +02:00

32 lines
906 B
JavaScript

import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
queryParams: {
order: { refreshModel: true },
asc: { refreshModel: true },
},
// TODO: this has been introduced to fix a bug in admin-users-list-show
// loading AdminUser model multiple times without refactoring the controller
beforeModel(transition) {
const routeName = "adminUsersList.show";
if (transition.targetName === routeName) {
const params = transition.routeInfos.find(
(a) => a.name === routeName
).params;
const controller = this.controllerFor(routeName);
if (controller) {
controller.setProperties({
order: transition.to.queryParams.order,
asc: transition.to.queryParams.asc,
query: params.filter,
refreshing: false,
});
controller.resetFilters();
}
}
},
});