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,10 +70,13 @@ async function oldDeArrowSubmitterOrAllowed(userID: HashedUserID): Promise<OldSu
const isOldSubmitter = result.submissionCount >= 1; const isOldSubmitter = result.submissionCount >= 1;
if (!isOldSubmitter) { if (!isOldSubmitter) {
if (!submitterThreshold) { if (!submitterThreshold) {
const voteResult = await privateDB.prepare("get", `SELECT "UUID" from "titleVotes" where "userID" = ?`, [userID], { useReplica: true }); 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 (voteResult?.UUID) { if (bannedResult?.submissionCount === 0) {
// Count at least one vote as an old submitter as well const voteResult = await privateDB.prepare("get", `SELECT "UUID" from "titleVotes" where "userID" = ?`, [userID], { useReplica: true });
return { canSubmit: true, newUser: false }; if (voteResult?.UUID) {
// Count at least one vote as an old submitter as well
return { canSubmit: true, newUser: false };
}
} }
} }