Skip to content

Commit

Permalink
Send a different message for VIP downvotes on locked titles
Browse files Browse the repository at this point in the history
  • Loading branch information
mini-bomba committed Nov 14, 2024
1 parent b2981fe commit 9738b76
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/routes/postBranding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export async function postBranding(req: Request, res: Response) {
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]);
}

sendWebhooks(videoID, UUID, voteType, wasWarned).catch((e) => Logger.error(e));
sendWebhooks(videoID, UUID, voteType, wasWarned, shouldLock).catch((e) => Logger.error(e));
}
})(), (async () => {
if (thumbnail) {
Expand Down Expand Up @@ -287,7 +287,7 @@ async function canSubmitOriginal(hashedUserID: HashedUserID, isVip: boolean): Pr
return isVip || (upvotedThumbs > 1 && customThumbs > 1 && originalThumbs / customThumbs < 0.4);
}

async function sendWebhooks(videoID: VideoID, UUID: BrandingUUID, voteType: BrandingVoteType, wasWarned: boolean) {
async function sendWebhooks(videoID: VideoID, UUID: BrandingUUID, voteType: BrandingVoteType, wasWarned: boolean, vipAction: boolean) {
const currentSubmission = await db.prepare(
"get",
`SELECT
Expand Down Expand Up @@ -384,7 +384,7 @@ async function sendWebhooks(videoID: VideoID, UUID: BrandingUUID, voteType: Bran
"embeds": [{
"title": data?.title,
"url": `https://www.youtube.com/watch?v=${videoID}`,
"description": `Locked title with **${currentSubmission.score}** score received a downvote\
"description": `Locked title ${vipAction ? 'was removed by a VIP' : `with **${currentSubmission.score}** score received a downvote`}\

Check warning on line 387 in src/routes/postBranding.ts

View workflow job for this annotation

GitHub Actions / Lint with ESLint and build

Strings must use doublequote
\n\n**Locked title:** ${currentSubmission.title}\
\n**Submitted by:** ${usernameRow?.userName ?? ""}\n${currentSubmission.userID}`,
"color": 10813440,
Expand Down

0 comments on commit 9738b76

Please sign in to comment.