musicbrainz-server
musicbrainz-server copied to clipboard
MBS-12798: Cancel open edits of user when it's marked as spammer
Implement MBS-12798
Problem
We used to delete spammers, but now we leave them behind (marked as spammers) so that SpamBrainz can eventually learn from them.
When we delete an editor, their open edits get cancelled and their votes on open edits changed to Abstain. When we mark someone as a spammer, nothing happens, but it seems sensible to do the same for them, since: a) we used to remove them b) their edits and votes are, by definition, dodgy.
Solution
This extracts the edit and vote cancellation step from editor removal into a reusable cancel_edits_and_votes
method and runs it also when an editor is marked as spammer. This means that their open edits will be cancelled and their votes on open edits will be changed to Abstain.
Testing
Manual testing: I added a new editor, entered a bunch of edits, marked them as spammer and checked they were all cancelled.
Also added a test for this.
@brainzbot, retest this please
No, we never send email about this AFAIK, it just automatically cancels and that's it.
Ok, separated the two bits, assuming that's what you meant :)