musicbrainz-server icon indicating copy to clipboard operation
musicbrainz-server copied to clipboard

MBS-12798: Cancel open edits of user when it's marked as spammer

Open reosarevok opened this issue 2 years ago • 3 comments

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.

reosarevok avatar Dec 23 '22 11:12 reosarevok

@brainzbot, retest this please

reosarevok avatar Jan 05 '23 09:01 reosarevok

No, we never send email about this AFAIK, it just automatically cancels and that's it.

reosarevok avatar Feb 17 '23 11:02 reosarevok

Ok, separated the two bits, assuming that's what you meant :)

reosarevok avatar Feb 17 '23 15:02 reosarevok