X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fcustom-validators%2Fusers.ts;h=c3cdefd4edfbd812ee648977f593c4526acbe3d2;hb=06a05d5f4784a7cbb27aa1188385b5679845dad8;hp=4a0d79ae58fff1c9fff770fbd61802cd198356f6;hpb=e69219184b1a3262ec5e617d30337b6431c9840c;p=github%2FChocobozzz%2FPeerTube.git 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,