mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-06 03:26:59 +03:00
Fix old user check
This commit is contained in:
@@ -70,12 +70,15 @@ async function oldDeArrowSubmitterOrAllowed(userID: HashedUserID): Promise<OldSu
|
||||
const isOldSubmitter = result.submissionCount >= 1;
|
||||
if (!isOldSubmitter) {
|
||||
if (!submitterThreshold) {
|
||||
const bannedResult = await db.prepare("get", `SELECT count(*) as "submissionCount" FROM "titles" JOIN "titleVotes" ON "titles"."UUID" = "titleVotes"."UUID" WHERE "userID" = ? AND "shadowHidden" != 0`, [userID], { useReplica: true });
|
||||
if (bannedResult?.submissionCount === 0) {
|
||||
const voteResult = await privateDB.prepare("get", `SELECT "UUID" from "titleVotes" where "userID" = ?`, [userID], { useReplica: true });
|
||||
if (voteResult?.UUID) {
|
||||
// Count at least one vote as an old submitter as well
|
||||
return { canSubmit: true, newUser: false };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await redis.zRemRangeByScore("submittersDeArrow", "-inf", Date.now() - fiveMinutes);
|
||||
const last5MinUsers = await redis.zCard("submittersDeArrow");
|
||||
|
||||
Reference in New Issue
Block a user