]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/shared/form-validators/video-channel-validators.ts
Fix backend channel name validator consistency
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / form-validators / video-channel-validators.ts
CommitLineData
7ed1edbb
C
1import { Validators } from '@angular/forms'
2import { BuildFormValidator } from './form-validator.model'
27db7840 3import { USER_USERNAME_VALIDATOR } from './user-validators'
7ed1edbb
C
4
5export const VIDEO_CHANNEL_NAME_VALIDATOR: BuildFormValidator = {
27db7840
C
6 // Use the same constraints than user usernmae
7 VALIDATORS: USER_USERNAME_VALIDATOR.VALIDATORS,
8
7ed1edbb
C
9 MESSAGES: {
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.`
14 }
15}
16
17export const VIDEO_CHANNEL_DISPLAY_NAME_VALIDATOR: BuildFormValidator = {
18 VALIDATORS: [
19 Validators.required,
20 Validators.minLength(1),
21 Validators.maxLength(50)
22 ],
23 MESSAGES: {
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.`
27 }
28}
29
30export const VIDEO_CHANNEL_DESCRIPTION_VALIDATOR: BuildFormValidator = {
31 VALIDATORS: [
32 Validators.minLength(3),
33 Validators.maxLength(1000)
34 ],
35 MESSAGES: {
36 'minlength': $localize`Description must be at least 3 characters long.`,
37 'maxlength': $localize`Description cannot be more than 1000 characters long.`
38 }
39}
40
41export const VIDEO_CHANNEL_SUPPORT_VALIDATOR: BuildFormValidator = {
42 VALIDATORS: [
43 Validators.minLength(3),
44 Validators.maxLength(1000)
45 ],
46 MESSAGES: {
47 'minlength': $localize`Support text must be at least 3 characters long.`,
48 'maxlength': $localize`Support text cannot be more than 1000 characters long`
49 }
50}