discourse/app/assets/javascripts/admin/routes/admin-users-list-show.js.es6

29 lines
856 B
Plaintext
Raw Normal View History

export default Discourse.Route.extend({
queryParams: {
order: { refreshModel: true },
ascending: { 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) {
2019-03-20 07:50:13 -04:00
const params = transition.routeInfos.find(a => a.name === routeName)
.params;
const controller = this.controllerFor(routeName);
if (controller) {
controller.setProperties({
2019-03-20 07:50:13 -04:00
order: transition.to.queryParams.order,
ascending: transition.to.queryParams.ascending,
query: params.filter,
refreshing: false
});
controller._refreshUsers();
}
}
}
});