Prevented upvotes on "dead" submissions unless they are VIP.

This commit is contained in:
Ajay Ramachandran
2020-05-10 00:08:05 -04:00
parent 8638698d61
commit b2705dfb2d
2 changed files with 41 additions and 0 deletions

View File

@@ -93,6 +93,16 @@ module.exports = async function voteOnSponsorTime(req, res) {
return categoryVote(UUID, userID, isVIP, category, hashedIP, res);
}
if (type == 1 && !isVIP) {
// Check if upvoting hidden segment
let voteInfo = db.prepare("SELECT votes FROM sponsorTimes WHERE UUID = ?").get(UUID);
if (voteInfo && voteInfo.votes <= -2) {
res.status(403).send("Not allowed to upvote segment with too many downvotes unless you are VIP.")
return;
}
}
let voteTypes = {
normal: 0,
incorrect: 1