mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-10 01:02:30 +01:00
Don't send to #dearrow-locked-titles when downvoting unlocked title
voteType passed to sendWebhooks() function to avoid confusion in the future should someone forget about the if statement
This commit is contained in:
parent
19d6d85aa6
commit
61dcfeb69f
1 changed files with 5 additions and 3 deletions
|
@ -113,7 +113,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).catch((e) => Logger.error(e));
|
||||
sendWebhooks(videoID, UUID, voteType).catch((e) => Logger.error(e));
|
||||
}
|
||||
})(), (async () => {
|
||||
if (thumbnail) {
|
||||
|
@ -290,7 +290,9 @@ export async function verifyOldSubmissions(hashedUserID: HashedUserID, verificat
|
|||
}
|
||||
}
|
||||
|
||||
async function sendWebhooks(videoID: VideoID, UUID: BrandingUUID) {
|
||||
async function sendWebhooks(videoID: VideoID, UUID: BrandingUUID, voteType: BrandingVoteType) {
|
||||
if (voteType === BrandingVoteType.Downvote) return; // Don't send messages to dearrow-locked-titles on downvotes
|
||||
|
||||
const lockedSubmission = await db.prepare("get", `SELECT "titleVotes"."votes", "titles"."title", "titles"."userID" FROM "titles" JOIN "titleVotes" ON "titles"."UUID" = "titleVotes"."UUID" WHERE "titles"."videoID" = ? AND "titles"."UUID" != ? AND "titleVotes"."locked" = 1`, [videoID, UUID]);
|
||||
|
||||
if (lockedSubmission) {
|
||||
|
|
Loading…
Reference in a new issue