From 9c01b711a5acdcaede066caed6d3c1efe0417c68 Mon Sep 17 00:00:00 2001 From: mini-bomba <55105495+mini-bomba@users.noreply.github.com> Date: Thu, 14 Nov 2024 22:16:58 +0100 Subject: [PATCH 1/2] Send a different message for VIP downvotes on locked titles --- src/routes/postBranding.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routes/postBranding.ts b/src/routes/postBranding.ts index 4c576164..e969aee0 100644 --- a/src/routes/postBranding.ts +++ b/src/routes/postBranding.ts @@ -86,7 +86,7 @@ export async function postBranding(req: Request, res: Response) { const existingIsLocked = !!existingUUID && (await db.prepare("get", `SELECT "locked" from "titleVotes" where "UUID" = ?`, [existingUUID]))?.locked; if (existingUUID != undefined && isBanned) return; // ignore votes on existing details from banned users if (downvote && existingIsLocked && !isVip) { - sendWebhooks(videoID, existingUUID, voteType, wasWarned).catch((e) => Logger.error(e)); + sendWebhooks(videoID, existingUUID, voteType, wasWarned, shouldLock).catch((e) => Logger.error(e)); errorCode = 403; return; } @@ -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) { @@ -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 @@ -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`}\ \n\n**Locked title:** ${currentSubmission.title}\ \n**Submitted by:** ${usernameRow?.userName ?? ""}\n${currentSubmission.userID}`, "color": 10813440, From 7ef6452eb57e181ea5090cacd8f95f1841e2a78a Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Thu, 14 Nov 2024 19:49:25 -0500 Subject: [PATCH 2/2] Double quote --- src/routes/postBranding.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/postBranding.ts b/src/routes/postBranding.ts index e969aee0..d6120f25 100644 --- a/src/routes/postBranding.ts +++ b/src/routes/postBranding.ts @@ -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 ${vipAction ? 'was removed by a VIP' : `with **${currentSubmission.score}** score received a downvote`}\ + "description": `Locked title ${vipAction ? "was removed by a VIP" : `with **${currentSubmission.score}** score received a downvote`}\ \n\n**Locked title:** ${currentSubmission.title}\ \n**Submitted by:** ${usernameRow?.userName ?? ""}\n${currentSubmission.userID}`, "color": 10813440,