Fix VIP title and thumbnail unlock unlocking everything

This commit is contained in:
Ajay
2023-05-31 14:28:01 -04:00
parent 9129cee9f0
commit 8e5be402e1
2 changed files with 27 additions and 2 deletions

View File

@@ -63,7 +63,7 @@ export async function postBranding(req: Request, res: Response) {
if (isVip) {
// unlock all other titles
await db.prepare("run", `UPDATE "titleVotes" SET "locked" = 0 FROM "titles" WHERE "titleVotes"."UUID" != ? AND "titles"."UUID" != ? AND "titles"."videoID" = ?`, [UUID, UUID, videoID]);
await db.prepare("run", `UPDATE "titleVotes" as tv SET "locked" = 0 FROM "titles" t WHERE tv."UUID" = t."UUID" AND tv."UUID" != ? AND t."videoID" = ?`, [UUID, videoID]);
}
}
})(), (async () => {
@@ -91,7 +91,7 @@ export async function postBranding(req: Request, res: Response) {
if (isVip) {
// unlock all other titles
await db.prepare("run", `UPDATE "thumbnailVotes" SET "locked" = 0 FROM "thumbnails" WHERE "thumbnailVotes"."UUID" != ? AND "thumbnails"."UUID" != ? AND "thumbnails"."videoID" = ?`, [UUID, UUID, videoID]);
await db.prepare("run", `UPDATE "thumbnailVotes" as tv SET "locked" = 0 FROM "thumbnails" t WHERE tv."UUID" = t."UUID" AND tv."UUID" != ? AND t."videoID" = ?`, [UUID, videoID]);
}
}
}