From eacb25c4366bcc8fba20f98f93f004fabc6d5578 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 8 Aug 2018 17:36:10 +0200 Subject: Add reason when banning a user --- server/helpers/custom-validators/users.ts | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'server/helpers/custom-validators/users.ts') diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts index 4a0d79ae5..c3cdefd4e 100644 --- a/server/helpers/custom-validators/users.ts +++ b/server/helpers/custom-validators/users.ts @@ -42,6 +42,10 @@ function isUserBlockedValid (value: any) { return isBooleanValid(value) } +function isUserBlockedReasonValid (value: any) { + return value === null || (exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.USERS.BLOCKED_REASON)) +} + function isUserRoleValid (value: any) { return exists(value) && validator.isInt('' + value) && UserRole[value] !== undefined } @@ -59,6 +63,7 @@ function isAvatarFile (files: { [ fieldname: string ]: Express.Multer.File[] } | export { isUserBlockedValid, isUserPasswordValid, + isUserBlockedReasonValid, isUserRoleValid, isUserVideoQuotaValid, isUserUsernameValid, -- cgit v1.2.3