Fix old user check

This commit is contained in:
Ajay
2025-04-28 19:03:24 -04:00
parent 339ba127eb
commit 314461c9f0

View File

@@ -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");