#5392 Add a new admin command to clean a spam user
Merged by ryanlerch. Opened by ryanlerch.
ryanlerch/pagure admin-clean-spammer  into  master

Download 5392.patch

Adds a new command to the pagure-admin cli tool that:

  • blocks the given user
  • deletes all the repos of the given user
  • deleles all the issues a user has filed
  • lists all the comments a user has done

In the future, will add deleting of comments as well, but there was no
method for doing this in the models (it appears it is done manaully in
the UI modules at the moment) -- I didnt want to dive too deep to get
this done, so we manually delete comments for now.

Signed-off-by: Ryan Lerch rlerch@redhat.com

I would add an extra flag that would be either --dry-run or --delete so that there is way to review what will be done before committing to it

We should add PR comments there as well, otherwise spammer will quickly realize they can spam there as well :)

ok, I see you've added an confirmation prompt down the line, so that'll do :)

Here you've printed before doing the deletion while for issues you did it after, we may want to be consistent (so it fails in a consistent place if it fails)

Too many empty lines for pep8/black to be happy here :)

rebased onto c51903c1e43ec868036c25f7c57462a896a95353

OK a few changes:

  • ran black over the code this time
  • changed the wording and location of the DELETING prompts -- these are now printed before we acutually do the change -- there was an issue with it not printing the information i needed after actaully deleting it, so i print them all before now.
  • still just only deleting projects and issue comments -- but now it prints out pull requests, pull request comments, and groups that the user has created.

I did not run it, but from the looks of it, it looks good to me!

Pull-Request has been merged by ryanlerch

Metadata