mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 03:54:33 +08:00
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:
@ -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
|
||||
|
Reference in New Issue
Block a user