From f1273314593a4a7dc7ec9594ce0c6c3ae8f62b34 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 16 Nov 2020 11:55:17 +0100 Subject: Add admin view to manage comments --- server/middlewares/validators/users.ts | 1 + server/middlewares/validators/videos/video-comments.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'server/middlewares/validators') diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index 452c7fb93..c91c378b3 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts @@ -41,6 +41,7 @@ import { Hooks } from '@server/lib/plugins/hooks' const usersListValidator = [ query('blocked') .optional() + .customSanitizer(toBooleanOrNull) .isBoolean().withMessage('Should be a valid boolean banned state'), (req: express.Request, res: express.Response, next: express.NextFunction) => { diff --git a/server/middlewares/validators/videos/video-comments.ts b/server/middlewares/validators/videos/video-comments.ts index 55fb60b98..a3c9febc4 100644 --- a/server/middlewares/validators/videos/video-comments.ts +++ b/server/middlewares/validators/videos/video-comments.ts @@ -2,7 +2,7 @@ import * as express from 'express' import { body, param, query } from 'express-validator' import { MUserAccountUrl } from '@server/types/models' import { UserRight } from '../../../../shared' -import { exists, isBooleanValid, isIdOrUUIDValid, isIdValid } from '../../../helpers/custom-validators/misc' +import { exists, isBooleanValid, isIdOrUUIDValid, isIdValid, toBooleanOrNull } from '../../../helpers/custom-validators/misc' import { doesVideoCommentExist, doesVideoCommentThreadExist, @@ -18,6 +18,7 @@ import { areValidationErrors } from '../utils' const listVideoCommentsValidator = [ query('isLocal') .optional() + .customSanitizer(toBooleanOrNull) .custom(isBooleanValid) .withMessage('Should have a valid is local boolean'), -- cgit v1.2.3