2019-10-22 08:46:10 -05:00
|
|
|
import DiscourseRoute from "discourse/routes/discourse";
|
|
|
|
|
2023-03-15 13:17:51 +00:00
|
|
|
export default class AdminUsersListShowRoute extends DiscourseRoute {
|
|
|
|
queryParams = {
|
2019-02-26 10:43:24 +01:00
|
|
|
order: { refreshModel: true },
|
2020-05-14 20:10:59 -06:00
|
|
|
asc: { refreshModel: true },
|
2023-03-15 13:17:51 +00:00
|
|
|
};
|
2014-11-26 13:05:49 -05:00
|
|
|
|
2019-02-26 10:43:24 +01:00
|
|
|
// 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) {
|
2022-07-06 10:37:54 +02:00
|
|
|
const params = transition.routeInfos.find(
|
|
|
|
(a) => a.name === routeName
|
|
|
|
).params;
|
2019-02-26 10:43:24 +01:00
|
|
|
const controller = this.controllerFor(routeName);
|
|
|
|
if (controller) {
|
|
|
|
controller.setProperties({
|
2019-03-20 12:50:13 +01:00
|
|
|
order: transition.to.queryParams.order,
|
2020-05-14 20:10:59 -06:00
|
|
|
asc: transition.to.queryParams.asc,
|
2019-02-26 10:43:24 +01:00
|
|
|
query: params.filter,
|
|
|
|
refreshing: false,
|
|
|
|
});
|
|
|
|
|
2019-07-01 11:00:06 +02:00
|
|
|
controller.resetFilters();
|
2019-02-26 10:43:24 +01:00
|
|
|
}
|
|
|
|
}
|
2023-03-15 13:17:51 +00:00
|
|
|
}
|
|
|
|
}
|