-
-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MBS-13492: Move beginner status to a privilege flag
This stops us having to calculate beginnership every time, which is slow and cumbersome, and implemented in at least three different places in slightly different ways. Every new editor added via /register will get the BEGINNER_FLAG privilege by default, which will only be removed by a cron job once the number of edits + time passed requirements are fulfilled. We will need to run a one-off script to set the flag on any existing beginners, added as 20240221-mbs-13492.sql. The flag cannot be set/unset via Edit user, since even admins should have no reason to override the default mechanism for this. One small benefit of this is we can better control who is a beginner for testing purposes, so we no longer need to add dummy edits just to allow a test editor to vote.
- Loading branch information
1 parent
1873cac
commit 4784bf7
Showing
37 changed files
with
204 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
\set ON_ERROR_STOP 1 | ||
|
||
BEGIN; | ||
|
||
UPDATE editor | ||
SET privs = privs | 8192 -- set new beginner flag | ||
WHERE id != 4 -- avoid setting ModBot as beginner | ||
AND NOT deleted | ||
AND ( | ||
member_since < NOW() - INTERVAL '2 weeks' | ||
OR | ||
NOT EXISTS ( | ||
SELECT 1 | ||
FROM edit | ||
WHERE edit.editor = editor.id | ||
AND edit.autoedit = 0 | ||
AND edit.status = 2 | ||
OFFSET 9 | ||
) | ||
); | ||
|
||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.