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,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 };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user