Fix backend channel name validator consistency

This commit is contained in:
Chocobozzz
2021-08-05 13:54:35 +02:00
parent 352819ef92
commit 27db78400c
5 changed files with 29 additions and 22 deletions

View File

@@ -1,13 +1,11 @@
import { Validators } from '@angular/forms'
import { BuildFormValidator } from './form-validator.model'
import { USER_USERNAME_VALIDATOR } from './user-validators'
export const VIDEO_CHANNEL_NAME_VALIDATOR: BuildFormValidator = {
VALIDATORS: [
Validators.required,
Validators.minLength(1),
Validators.maxLength(50),
Validators.pattern(/^[a-z0-9][a-z0-9._]*$/)
],
// Use the same constraints than user usernmae
VALIDATORS: USER_USERNAME_VALIDATOR.VALIDATORS,
MESSAGES: {
'required': $localize`Name is required.`,
'minlength': $localize`Name must be at least 1 character long.`,