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.
This commit is contained in:
Osama Sayegh
2024-11-25 11:13:35 +03:00
committed by GitHub
parent eaa3f813c1
commit 118f7869bb
22 changed files with 995 additions and 44 deletions

View File

@ -89,4 +89,24 @@ RSpec.describe AdminUserListSerializer do
expect(json[:secondary_emails]).to contain_exactly("first@email.com", "second@email.com")
end
end
describe "#can_be_deleted" do
it "is not included if the include_can_be_deleted option is not present" do
json = AdminUserListSerializer.new(user, scope: guardian, root: false).as_json
expect(json.key?(:can_be_deleted)).to eq(false)
end
it "is included if the include_can_be_deleted option is true" do
json =
AdminUserListSerializer.new(
user,
scope: guardian,
root: false,
include_can_be_deleted: true,
).as_json
expect(json[:can_be_deleted]).to eq(true)
end
end
end