Files
discourse/app/assets/javascripts/admin/addon/routes/admin-users-list-show.js
Osama Sayegh 118f7869bb FEATURE: Add bulk destroy to admin users list (#29744)
This commit introduces a new feature that allows staff to bulk select and delete users directly from the users list at `/admin/users/list`. The main use-case for this feature is make deleting spammers easier when a site is under a large spam attack.

Internal topic: t/140321.
2024-11-25 11:13:35 +03:00

37 lines
1.1 KiB
JavaScript

import DiscourseRoute from "discourse/routes/discourse";
export default class AdminUsersListShowRoute extends DiscourseRoute {
queryParams = {
order: { refreshModel: true },
asc: { refreshModel: true },
username: { 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,
listFilter: transition.to.queryParams.username,
query: params.filter,
refreshing: false,
bulkSelectedUsersMap: {},
bulkSelectedUserIdsSet: new Set(),
displayBulkActions: false,
});
controller.resetFilters();
}
}
}
}