Add Limit 1 when check user as vip

This commit is contained in:
Haidang666
2021-08-03 09:28:28 +07:00
parent 09626ee6f6
commit 38a09b164d
3 changed files with 11 additions and 7 deletions

View File

@@ -281,7 +281,7 @@ export async function voteOnSponsorTime(req: Request, res: Response): Promise<Re
const hashedIP: HashedIP = getHash((ip + config.globalSalt) as IPAddress);
//check if this user is on the vip list
const isVIP = (await db.prepare("get", `SELECT count(*) as "userCount" FROM "vipUsers" WHERE "userID" = ?`, [nonAnonUserID])).userCount > 0;
const isVIP = await isUserVIP(nonAnonUserID);
//check if user voting on own submission
const isOwnSubmission = (await db.prepare("get", `SELECT "UUID" as "submissionCount" FROM "sponsorTimes" where "userID" = ? AND "UUID" = ?`, [nonAnonUserID, UUID])) !== undefined;