From 934ce7972814fd4ab1000113e254c561d971a509 Mon Sep 17 00:00:00 2001 From: mini-bomba <55105495+mini-bomba@users.noreply.github.com> Date: Tue, 12 Sep 2023 23:40:39 +0200 Subject: [PATCH 1/4] Replace "warning" with "tip" in responses from postWarning.ts --- src/routes/postWarning.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/postWarning.ts b/src/routes/postWarning.ts index aed4094..20a4c0b 100644 --- a/src/routes/postWarning.ts +++ b/src/routes/postWarning.ts @@ -59,7 +59,7 @@ export async function postWarning(req: Request, res: Response): Promise Date: Sat, 16 Sep 2023 10:00:33 +0200 Subject: [PATCH 2/4] Replace "Warning reason" with "Tip message" --- src/routes/postSkipSegments.ts | 2 +- src/routes/voteOnSponsorTime.ts | 2 +- test/cases/postSkipSegmentsWarnings.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/routes/postSkipSegments.ts b/src/routes/postSkipSegments.ts index ee4a459..61ccc67 100644 --- a/src/routes/postSkipSegments.ts +++ b/src/routes/postSkipSegments.ts @@ -179,7 +179,7 @@ async function checkUserActiveWarning(userID: HashedUserID): Promise 0 ? `\n\nWarning reason: '${warnings[0].reason}'` : ""), + errorMessage: defaultMessage + (warnings[0]?.reason?.length > 0 ? `\n\nTip message: '${warnings[0].reason}'` : ""), errorCode: 403 }; } diff --git a/src/routes/voteOnSponsorTime.ts b/src/routes/voteOnSponsorTime.ts index bc3728c..9c9fe2e 100644 --- a/src/routes/voteOnSponsorTime.ts +++ b/src/routes/voteOnSponsorTime.ts @@ -384,7 +384,7 @@ export async function vote(ip: IPAddress, UUID: SegmentUUID, paramUserID: UserID lock.unlock(); return { status: 403, message: "Vote rejected due to a tip from a moderator. This means that we noticed you were making some common mistakes that are not malicious, and we just want to clarify the rules. " + "Could you please send a message in Discord or Matrix so we can further help you?" + - `${(warningReason.length > 0 ? ` Warning reason: '${warningReason}'` : "")}` }; + `${(warningReason.length > 0 ? ` Tip message: '${warningReason}'` : "")}` }; } // we can return out of the function early if the user is banned after warning checks diff --git a/test/cases/postSkipSegmentsWarnings.ts b/test/cases/postSkipSegmentsWarnings.ts index 209b425..2af7a56 100644 --- a/test/cases/postSkipSegmentsWarnings.ts +++ b/test/cases/postSkipSegmentsWarnings.ts @@ -63,7 +63,7 @@ describe("postSkipSegments Warnings", () => { const expected = "Submission rejected due to a tip from a moderator. This means that we noticed you were making some common mistakes" + " that are not malicious, and we just want to clarify the rules. " + "Could you please send a message in discord.gg/SponsorBlock or matrix.to/#/#sponsor:ajay.app so we can further help you? " - + `Your userID is ${warnUser01Hash}.\n\nWarning reason: '${reason}'`; + + `Your userID is ${warnUser01Hash}.\n\nTip message: '${reason}'`; assert.strictEqual(errorMessage, expected); done(); From e329bccca5d6fc99ad9bf5481e0a5918ffbdd4c6 Mon Sep 17 00:00:00 2001 From: Ajay Date: Wed, 27 Sep 2023 20:09:15 -0400 Subject: [PATCH 3/4] Remove shuffling for thumbnails --- src/routes/getBranding.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/routes/getBranding.ts b/src/routes/getBranding.ts index b832f3e..634c1e5 100644 --- a/src/routes/getBranding.ts +++ b/src/routes/getBranding.ts @@ -35,7 +35,8 @@ export async function getVideoBranding(res: Response, videoID: VideoID, service: "all", `SELECT "thumbnailTimestamps"."timestamp", "thumbnails"."original", "thumbnailVotes"."votes", "thumbnailVotes"."locked", "thumbnailVotes"."shadowHidden", "thumbnails"."UUID", "thumbnails"."videoID", "thumbnails"."hashedVideoID", "thumbnails"."userID" FROM "thumbnails" LEFT JOIN "thumbnailVotes" ON "thumbnails"."UUID" = "thumbnailVotes"."UUID" LEFT JOIN "thumbnailTimestamps" ON "thumbnails"."UUID" = "thumbnailTimestamps"."UUID" - WHERE "thumbnails"."videoID" = ? AND "thumbnails"."service" = ? AND "thumbnailVotes"."votes" > -2`, + WHERE "thumbnails"."videoID" = ? AND "thumbnails"."service" = ? AND "thumbnailVotes"."votes" > -2 + ORDER BY "thumbnails"."timeSubmitted" ASC`, [videoID, service], { useReplica: true } ) as Promise; @@ -99,7 +100,8 @@ export async function getVideoBrandingByHash(videoHashPrefix: VideoIDHash, servi "all", `SELECT "thumbnailTimestamps"."timestamp", "thumbnails"."original", "thumbnailVotes"."votes", "thumbnailVotes"."locked", "thumbnailVotes"."shadowHidden", "thumbnails"."UUID", "thumbnails"."videoID", "thumbnails"."hashedVideoID" FROM "thumbnails" LEFT JOIN "thumbnailVotes" ON "thumbnails"."UUID" = "thumbnailVotes"."UUID" LEFT JOIN "thumbnailTimestamps" ON "thumbnails"."UUID" = "thumbnailTimestamps"."UUID" - WHERE "thumbnails"."hashedVideoID" LIKE ? AND "thumbnails"."service" = ? AND "thumbnailVotes"."votes" > -2`, + WHERE "thumbnails"."hashedVideoID" LIKE ? AND "thumbnails"."service" = ? AND "thumbnailVotes"."votes" > -2 + ORDER BY "thumbnails"."timeSubmitted" ASC`, [`${videoHashPrefix}%`, service], { useReplica: true } ) as Promise; @@ -182,7 +184,7 @@ async function filterAndSortBranding(videoID: VideoID, returnUserID: boolean, db .sort((a, b) => b.votes - a.votes) .sort((a, b) => +b.locked - +a.locked) as TitleResult[]; - const thumbnails = shuffleArray(dbThumbnails.filter(await shouldKeepThumbnails)) + const thumbnails = dbThumbnails.filter(await shouldKeepThumbnails) .sort((a, b) => +a.original - +b.original) .sort((a, b) => b.votes - a.votes) .sort((a, b) => b.locked - a.locked) From a659048afed3bec83dcf54c8c67a889e275d123a Mon Sep 17 00:00:00 2001 From: Ajay Date: Mon, 2 Oct 2023 19:56:08 -0400 Subject: [PATCH 4/4] Hide downvotes titles --- src/routes/getBranding.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/getBranding.ts b/src/routes/getBranding.ts index 634c1e5..3013c40 100644 --- a/src/routes/getBranding.ts +++ b/src/routes/getBranding.ts @@ -26,7 +26,7 @@ export async function getVideoBranding(res: Response, videoID: VideoID, service: "all", `SELECT "titles"."title", "titles"."original", "titleVotes"."votes", "titleVotes"."locked", "titleVotes"."shadowHidden", "titles"."UUID", "titles"."videoID", "titles"."hashedVideoID", "titleVotes"."verification", "titles"."userID" FROM "titles" JOIN "titleVotes" ON "titles"."UUID" = "titleVotes"."UUID" - WHERE "titles"."videoID" = ? AND "titles"."service" = ? AND "titleVotes"."votes" > -2`, + WHERE "titles"."videoID" = ? AND "titles"."service" = ? AND "titleVotes"."votes" > -1`, [videoID, service], { useReplica: true } ) as Promise;