aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/validators/abuse.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/server/middlewares/validators/abuse.ts b/server/middlewares/validators/abuse.ts
index cb0bc658a..2a096e0af 100644
--- a/server/middlewares/validators/abuse.ts
+++ b/server/middlewares/validators/abuse.ts
@@ -201,6 +201,21 @@ const getAbuseValidator = [
201 } 201 }
202] 202]
203 203
204const checkAbuseValidForMessagesValidator = [
205 (req: express.Request, res: express.Response, next: express.NextFunction) => {
206 logger.debug('Checking checkAbuseValidForMessagesValidator parameters', { parameters: req.body })
207
208 const abuse = res.locals.abuse
209 if (abuse.ReporterAccount.isOwned() === false) {
210 return res.status(400).json({
211 error: 'This abuse was created by a user of your instance.',
212 })
213 }
214
215 return next()
216 }
217]
218
204const addAbuseMessageValidator = [ 219const addAbuseMessageValidator = [
205 body('message').custom(isAbuseMessageValid).not().isEmpty().withMessage('Should have a valid abuse message'), 220 body('message').custom(isAbuseMessageValid).not().isEmpty().withMessage('Should have a valid abuse message'),
206 221
@@ -357,6 +372,7 @@ export {
357 abuseReportValidator, 372 abuseReportValidator,
358 abuseGetValidator, 373 abuseGetValidator,
359 addAbuseMessageValidator, 374 addAbuseMessageValidator,
375 checkAbuseValidForMessagesValidator,
360 abuseUpdateValidator, 376 abuseUpdateValidator,
361 deleteAbuseMessageValidator, 377 deleteAbuseMessageValidator,
362 abuseListForUserValidator, 378 abuseListForUserValidator,