1 import { Validators } from '@angular/forms'
2 import { BuildFormValidator } from './form-validator.model'
3 import { USER_USERNAME_VALIDATOR } from './user-validators'
5 export const VIDEO_CHANNEL_NAME_VALIDATOR: BuildFormValidator = {
6 // Use the same constraints than user usernmae
7 VALIDATORS: USER_USERNAME_VALIDATOR.VALIDATORS,
10 required: $localize`Name is required.`,
11 minlength: $localize`Name must be at least 1 character long.`,
12 maxlength: $localize`Name cannot be more than 50 characters long.`,
13 pattern: $localize`Name should be lowercase alphanumeric; dots and underscores are allowed.`
17 export const VIDEO_CHANNEL_DISPLAY_NAME_VALIDATOR: BuildFormValidator = {
20 Validators.minLength(1),
21 Validators.maxLength(50)
24 required: $localize`Display name is required.`,
25 minlength: $localize`Display name must be at least 1 character long.`,
26 maxlength: $localize`Display name cannot be more than 50 characters long.`
30 export const VIDEO_CHANNEL_DESCRIPTION_VALIDATOR: BuildFormValidator = {
32 Validators.minLength(3),
33 Validators.maxLength(1000)
36 minlength: $localize`Description must be at least 3 characters long.`,
37 maxlength: $localize`Description cannot be more than 1000 characters long.`
41 export const VIDEO_CHANNEL_SUPPORT_VALIDATOR: BuildFormValidator = {
43 Validators.minLength(3),
44 Validators.maxLength(1000)
47 minlength: $localize`Support text must be at least 3 characters long.`,
48 maxlength: $localize`Support text cannot be more than 1000 characters long.`
52 export const VIDEO_CHANNEL_EXTERNAL_URL_VALIDATOR: BuildFormValidator = {
55 Validators.pattern(/^https?:\/\//),
56 Validators.maxLength(1000)
59 required: $localize`Remote channel url is required.`,
60 pattern: $localize`External channel URL must begin with "https://" or "http://"`,
61 maxlength: $localize`External channel URL cannot be more than 1000 characters long`