Don't moderate if VIP.

This commit is contained in:
Ajay Ramachandran
2020-04-30 19:17:52 -04:00
parent a278036f1d
commit eb936d579c

View File

@@ -181,6 +181,9 @@ module.exports = async function postSkipSegments(req, res) {
//hash the ip 5000 times so no one can get it from the database //hash the ip 5000 times so no one can get it from the database
let hashedIP = getHash(getIP(req) + config.globalSalt); let hashedIP = getHash(getIP(req) + config.globalSalt);
//check if this user is on the vip list
let isVIP = db.prepare("SELECT count(*) as userCount FROM vipUsers WHERE userID = ?").get(userID).userCount > 0;
// Check if all submissions are correct // Check if all submissions are correct
for (let i = 0; i < segments.length; i++) { for (let i = 0; i < segments.length; i++) {
if (segments[i] === undefined || segments[i].segment === undefined || segments[i].category === undefined) { if (segments[i] === undefined || segments[i].segment === undefined || segments[i].category === undefined) {
@@ -207,17 +210,17 @@ module.exports = async function postSkipSegments(req, res) {
return; return;
} }
} }
// Auto moderator check // Auto moderator check
let autoModerateResult = await autoModerateSubmission(videoID, segments); if (!isVIP) {
if (autoModerateResult) { let autoModerateResult = await autoModerateSubmission(videoID, segments);
res.status(403).send("Request rejected by auto moderator: " + autoModerateResult); if (autoModerateResult) {
return; res.status(403).send("Request rejected by auto moderator: " + autoModerateResult);
return;
}
} }
try { try {
//check if this user is on the vip list
let vipRow = db.prepare("SELECT count(*) as userCount FROM vipUsers WHERE userID = ?").get(userID);
//get current time //get current time
let timeSubmitted = Date.now(); let timeSubmitted = Date.now();
@@ -254,7 +257,7 @@ module.exports = async function postSkipSegments(req, res) {
} }
let startingVotes = 0; let startingVotes = 0;
if (vipRow.userCount > 0) { if (isVIP) {
//this user is a vip, start them at a higher approval rating //this user is a vip, start them at a higher approval rating
startingVotes = 10; startingVotes = 10;
} }