]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/custom-validators/users.ts
Add subscriptions endpoints to REST API
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / users.ts
index 4a0d79ae58fff1c9fff770fbd61802cd198356f6..c3cdefd4edfbd812ee648977f593c4526acbe3d2 100644 (file)
@@ -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,