MBS-13492: Move beginner status to a privilege flag #3180
+263
−189
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement MBS-13492
Problem
Anything that requires checking whether an editor is a beginner requires us to calculate beginnership every time, which is slow and cumbersome, and implemented in at least three different places in slightly different ways. Specifically, calculating beginnership as part of edit search conditions is awfully, terribly slow.
Solution
Every new editor added via /register will get the
BEGINNER_FLAG
privilege by default, which will only be removedwhen accepting edits once the number of edits + time passed requirements are fulfilled. The flag cannot be set/unset via Edit user, since even admins should have no reason to override the default mechanism for this.
We calculate this in
_do_accept
, rather than the edit queue itself, because approvals skip the edit queue but are still relevant for this check.We run a one-off script to set the flag on any existing beginners.
Testing
Registered a new user and saw it does get the Beginner flag. Added a test to make sure the
EditQueue
processing removes the beginner flag when appropriate.Draft progress
CheckVotes
on a per-edit basis, since we have the editor loaded and we can check theirprivs
andmember_since
without having to query them, so we would only need to check if they have the required amount of edits and then unset their beginner flag).