Add ability to ban/unban users
[oweals/peertube.git] / client / src / app / shared / forms / form-validators / user-validators.service.ts
index 5edae2e3803c0d130a5f4591a15bbd642431a47b..ec9566ef38f77413090f1e204a05905d4de1e7a0 100644 (file)
@@ -14,6 +14,8 @@ export class UserValidatorsService {
   readonly USER_DESCRIPTION: BuildFormValidator
   readonly USER_TERMS: BuildFormValidator
 
+  readonly USER_BAN_REASON: BuildFormValidator
+
   constructor (private i18n: I18n) {
 
     this.USER_USERNAME = {
@@ -99,5 +101,16 @@ export class UserValidatorsService {
         'required': this.i18n('You must to agree with the instance terms in order to registering on it.')
       }
     }
+
+    this.USER_BAN_REASON = {
+      VALIDATORS: [
+        Validators.minLength(3),
+        Validators.maxLength(250)
+      ],
+      MESSAGES: {
+        'minlength': this.i18n('Ban reason must be at least 3 characters long.'),
+        'maxlength': this.i18n('Ban reason cannot be more than 250 characters long.')
+      }
+    }
   }
 }