mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-09-20 04:54:00 +02:00
Send longest warning reason
This commit is contained in:
parent
bddadc6a9e
commit
497a509d60
1 changed files with 2 additions and 2 deletions
|
@ -284,7 +284,7 @@ async function getYouTubeVideoInfo(videoID: VideoID, ignoreCache = false): Promi
|
|||
async function checkUserActiveWarning(userID: string): Promise<CheckResult> {
|
||||
const MILLISECONDS_IN_HOUR = 3600000;
|
||||
const now = Date.now();
|
||||
const warnings = await db.prepare("all",
|
||||
const warnings = (await db.prepare("all",
|
||||
`SELECT "reason"
|
||||
FROM warnings
|
||||
WHERE "userID" = ? AND "issueTime" > ? AND enabled = 1
|
||||
|
@ -295,7 +295,7 @@ async function checkUserActiveWarning(userID: string): Promise<CheckResult> {
|
|||
Math.floor(now - (config.hoursAfterWarningExpires * MILLISECONDS_IN_HOUR)),
|
||||
config.maxNumberOfActiveWarnings
|
||||
],
|
||||
) as {reason: string}[];
|
||||
) as {reason: string}[]).sort((a, b) => (b?.reason?.length ?? 0) - (a?.reason?.length ?? 0));
|
||||
|
||||
if (warnings?.length >= config.maxNumberOfActiveWarnings) {
|
||||
const defaultMessage = "Submission rejected due to a warning from a moderator. This means that we noticed you were making some common mistakes"
|
||||
|
|
Loading…
Reference in a new issue