2014-11-27 02:05:49 +08:00
|
|
|
export default Discourse.Route.extend({
|
2019-02-26 17:43:24 +08:00
|
|
|
queryParams: {
|
|
|
|
order: { refreshModel: true },
|
|
|
|
ascending: { refreshModel: true }
|
2014-11-27 02:05:49 +08:00
|
|
|
},
|
|
|
|
|
2019-02-26 17:43:24 +08: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) {
|
2019-03-20 19:50:13 +08:00
|
|
|
const params = transition.routeInfos.find(a => a.name === routeName)
|
|
|
|
.params;
|
2019-02-26 17:43:24 +08:00
|
|
|
const controller = this.controllerFor(routeName);
|
|
|
|
if (controller) {
|
|
|
|
controller.setProperties({
|
2019-03-20 19:50:13 +08:00
|
|
|
order: transition.to.queryParams.order,
|
|
|
|
ascending: transition.to.queryParams.ascending,
|
2019-02-26 17:43:24 +08:00
|
|
|
query: params.filter,
|
|
|
|
refreshing: false
|
|
|
|
});
|
|
|
|
|
|
|
|
controller._refreshUsers();
|
|
|
|
}
|
|
|
|
}
|
2014-11-27 02:05:49 +08:00
|
|
|
}
|
|
|
|
});
|