From e6b2243496b1d18c1ecde81f5a9fc8cfaba65278 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sat, 24 Jul 2021 16:04:40 -0400 Subject: [PATCH 1/2] Add link to discord and matrix --- src/routes/postSkipSegments.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/routes/postSkipSegments.ts b/src/routes/postSkipSegments.ts index 4f18cd0..cc24c35 100644 --- a/src/routes/postSkipSegments.ts +++ b/src/routes/postSkipSegments.ts @@ -286,12 +286,12 @@ async function checkUserActiveWarning(userID: string): Promise<{ pass: boolean; 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" + " 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? " + + "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 ${userID}.`; return { pass: false, - errorMessage: defaultMessage + (warnings[0]?.reason?.length > 0 ? ` Warning reason: ${warnings[0].reason}` : "") + errorMessage: defaultMessage + (warnings[0]?.reason?.length > 0 ? `\n\nWarning reason: ${warnings[0].reason}` : "") }; } @@ -433,7 +433,7 @@ export async function postSkipSegments(req: Request, res: Response): Promise Date: Sun, 25 Jul 2021 14:34:55 -0400 Subject: [PATCH 2/2] fix tests --- test/cases/postSkipSegments.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/cases/postSkipSegments.ts b/test/cases/postSkipSegments.ts index d67ca23..7ab933d 100644 --- a/test/cases/postSkipSegments.ts +++ b/test/cases/postSkipSegments.ts @@ -586,7 +586,11 @@ describe("postSkipSegments", () => { const errorMessage = await res.text(); const reason = "Reason01"; const userID = "09dee632bfbb1acc9fda3169cc14b46e459b45cee4f4449be305590e612b5eb7"; - const expected = `Submission rejected due to a warning 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? Your userID is ${userID}. Warning reason: ${reason}`; + const expected = "Submission rejected due to a warning 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 ${userID}.\n\nWarning reason: ${reason}`; + assert.strictEqual(errorMessage, expected); done(); })