aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/form-validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-08-17 14:42:53 +0200
committerChocobozzz <me@florianbigard.com>2021-08-18 08:35:06 +0200
commit9df52d660feb722404be00a50f3c8a612bec1c15 (patch)
treedde52880fa012874d24c60f64eb596b0a789cc8b /client/src/app/shared/form-validators
parentadb8809d43648ea0a64d6845bb39aa3bd0e005a6 (diff)
downloadPeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.tar.gz
PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.tar.zst
PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.zip
Migrate client to eslint
Diffstat (limited to 'client/src/app/shared/form-validators')
-rw-r--r--client/src/app/shared/form-validators/abuse-validators.ts24
-rw-r--r--client/src/app/shared/form-validators/custom-config-validators.ts88
-rw-r--r--client/src/app/shared/form-validators/form-validator.model.ts2
-rw-r--r--client/src/app/shared/form-validators/host-validators.ts20
-rw-r--r--client/src/app/shared/form-validators/instance-validators.ts24
-rw-r--r--client/src/app/shared/form-validators/login-validators.ts4
-rw-r--r--client/src/app/shared/form-validators/reset-password-validators.ts2
-rw-r--r--client/src/app/shared/form-validators/user-validators.ts64
-rw-r--r--client/src/app/shared/form-validators/video-block-validators.ts4
-rw-r--r--client/src/app/shared/form-validators/video-captions-validators.ts4
-rw-r--r--client/src/app/shared/form-validators/video-channel-validators.ts22
-rw-r--r--client/src/app/shared/form-validators/video-comment-validators.ts6
-rw-r--r--client/src/app/shared/form-validators/video-ownership-change-validators.ts8
-rw-r--r--client/src/app/shared/form-validators/video-playlist-validators.ts16
-rw-r--r--client/src/app/shared/form-validators/video-validators.ts32
15 files changed, 160 insertions, 160 deletions
diff --git a/client/src/app/shared/form-validators/abuse-validators.ts b/client/src/app/shared/form-validators/abuse-validators.ts
index 75bfacf01..8d3c411b4 100644
--- a/client/src/app/shared/form-validators/abuse-validators.ts
+++ b/client/src/app/shared/form-validators/abuse-validators.ts
@@ -2,28 +2,28 @@ import { Validators } from '@angular/forms'
2import { BuildFormValidator } from './form-validator.model' 2import { BuildFormValidator } from './form-validator.model'
3 3
4export const ABUSE_REASON_VALIDATOR: BuildFormValidator = { 4export const ABUSE_REASON_VALIDATOR: BuildFormValidator = {
5 VALIDATORS: [Validators.required, Validators.minLength(2), Validators.maxLength(3000)], 5 VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ],
6 MESSAGES: { 6 MESSAGES: {
7 'required': $localize`Report reason is required.`, 7 required: $localize`Report reason is required.`,
8 'minlength': $localize`Report reason must be at least 2 characters long.`, 8 minlength: $localize`Report reason must be at least 2 characters long.`,
9 'maxlength': $localize`Report reason cannot be more than 3000 characters long.` 9 maxlength: $localize`Report reason cannot be more than 3000 characters long.`
10 } 10 }
11} 11}
12 12
13export const ABUSE_MODERATION_COMMENT_VALIDATOR: BuildFormValidator = { 13export const ABUSE_MODERATION_COMMENT_VALIDATOR: BuildFormValidator = {
14 VALIDATORS: [Validators.required, Validators.minLength(2), Validators.maxLength(3000)], 14 VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ],
15 MESSAGES: { 15 MESSAGES: {
16 'required': $localize`Moderation comment is required.`, 16 required: $localize`Moderation comment is required.`,
17 'minlength': $localize`Moderation comment must be at least 2 characters long.`, 17 minlength: $localize`Moderation comment must be at least 2 characters long.`,
18 'maxlength': $localize`Moderation comment cannot be more than 3000 characters long.` 18 maxlength: $localize`Moderation comment cannot be more than 3000 characters long.`
19 } 19 }
20} 20}
21 21
22export const ABUSE_MESSAGE_VALIDATOR: BuildFormValidator = { 22export const ABUSE_MESSAGE_VALIDATOR: BuildFormValidator = {
23 VALIDATORS: [Validators.required, Validators.minLength(2), Validators.maxLength(3000)], 23 VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ],
24 MESSAGES: { 24 MESSAGES: {
25 'required': $localize`Abuse message is required.`, 25 required: $localize`Abuse message is required.`,
26 'minlength': $localize`Abuse message must be at least 2 characters long.`, 26 minlength: $localize`Abuse message must be at least 2 characters long.`,
27 'maxlength': $localize`Abuse message cannot be more than 3000 characters long.` 27 maxlength: $localize`Abuse message cannot be more than 3000 characters long.`
28 } 28 }
29} 29}
diff --git a/client/src/app/shared/form-validators/custom-config-validators.ts b/client/src/app/shared/form-validators/custom-config-validators.ts
index 1ed5700ff..fbf423d08 100644
--- a/client/src/app/shared/form-validators/custom-config-validators.ts
+++ b/client/src/app/shared/form-validators/custom-config-validators.ts
@@ -2,120 +2,120 @@ import { Validators } from '@angular/forms'
2import { BuildFormValidator } from './form-validator.model' 2import { BuildFormValidator } from './form-validator.model'
3 3
4export const INSTANCE_NAME_VALIDATOR: BuildFormValidator = { 4export const INSTANCE_NAME_VALIDATOR: BuildFormValidator = {
5 VALIDATORS: [Validators.required], 5 VALIDATORS: [ Validators.required ],
6 MESSAGES: { 6 MESSAGES: {
7 'required': $localize`Instance name is required.` 7 required: $localize`Instance name is required.`
8 } 8 }
9} 9}
10 10
11export const INSTANCE_SHORT_DESCRIPTION_VALIDATOR: BuildFormValidator = { 11export const INSTANCE_SHORT_DESCRIPTION_VALIDATOR: BuildFormValidator = {
12 VALIDATORS: [Validators.max(250)], 12 VALIDATORS: [ Validators.max(250) ],
13 MESSAGES: { 13 MESSAGES: {
14 'max': $localize`Short description should not be longer than 250 characters.` 14 max: $localize`Short description should not be longer than 250 characters.`
15 } 15 }
16} 16}
17 17
18export const SERVICES_TWITTER_USERNAME_VALIDATOR: BuildFormValidator = { 18export const SERVICES_TWITTER_USERNAME_VALIDATOR: BuildFormValidator = {
19 VALIDATORS: [Validators.required], 19 VALIDATORS: [ Validators.required ],
20 MESSAGES: { 20 MESSAGES: {
21 'required': $localize`Twitter username is required.` 21 required: $localize`Twitter username is required.`
22 } 22 }
23} 23}
24 24
25export const CACHE_PREVIEWS_SIZE_VALIDATOR: BuildFormValidator = { 25export const CACHE_PREVIEWS_SIZE_VALIDATOR: BuildFormValidator = {
26 VALIDATORS: [Validators.required, Validators.min(1), Validators.pattern('[0-9]+')], 26 VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ],
27 MESSAGES: { 27 MESSAGES: {
28 'required': $localize`Previews cache size is required.`, 28 required: $localize`Previews cache size is required.`,
29 'min': $localize`Previews cache size must be greater than 1.`, 29 min: $localize`Previews cache size must be greater than 1.`,
30 'pattern': $localize`Previews cache size must be a number.` 30 pattern: $localize`Previews cache size must be a number.`
31 } 31 }
32} 32}
33 33
34export const CACHE_CAPTIONS_SIZE_VALIDATOR: BuildFormValidator = { 34export const CACHE_CAPTIONS_SIZE_VALIDATOR: BuildFormValidator = {
35 VALIDATORS: [Validators.required, Validators.min(1), Validators.pattern('[0-9]+')], 35 VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ],
36 MESSAGES: { 36 MESSAGES: {
37 'required': $localize`Captions cache size is required.`, 37 required: $localize`Captions cache size is required.`,
38 'min': $localize`Captions cache size must be greater than 1.`, 38 min: $localize`Captions cache size must be greater than 1.`,
39 'pattern': $localize`Captions cache size must be a number.` 39 pattern: $localize`Captions cache size must be a number.`
40 } 40 }
41} 41}
42 42
43export const SIGNUP_LIMIT_VALIDATOR: BuildFormValidator = { 43export const SIGNUP_LIMIT_VALIDATOR: BuildFormValidator = {
44 VALIDATORS: [Validators.required, Validators.min(-1), Validators.pattern('-?[0-9]+')], 44 VALIDATORS: [ Validators.required, Validators.min(-1), Validators.pattern('-?[0-9]+') ],
45 MESSAGES: { 45 MESSAGES: {
46 'required': $localize`Signup limit is required.`, 46 required: $localize`Signup limit is required.`,
47 'min': $localize`Signup limit must be greater than 1. Use -1 to disable it.`, 47 min: $localize`Signup limit must be greater than 1. Use -1 to disable it.`,
48 'pattern': $localize`Signup limit must be a number.` 48 pattern: $localize`Signup limit must be a number.`
49 } 49 }
50} 50}
51 51
52export const SIGNUP_MINIMUM_AGE_VALIDATOR: BuildFormValidator = { 52export const SIGNUP_MINIMUM_AGE_VALIDATOR: BuildFormValidator = {
53 VALIDATORS: [Validators.required, Validators.min(1), Validators.pattern('[0-9]+')], 53 VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ],
54 MESSAGES: { 54 MESSAGES: {
55 'required': $localize`Signup minimum age is required.`, 55 required: $localize`Signup minimum age is required.`,
56 'min': $localize`Signup minimum age must be greater than 1.`, 56 min: $localize`Signup minimum age must be greater than 1.`,
57 'pattern': $localize`Signup minimum age must be a number.` 57 pattern: $localize`Signup minimum age must be a number.`
58 } 58 }
59} 59}
60 60
61export const ADMIN_EMAIL_VALIDATOR: BuildFormValidator = { 61export const ADMIN_EMAIL_VALIDATOR: BuildFormValidator = {
62 VALIDATORS: [Validators.required, Validators.email], 62 VALIDATORS: [ Validators.required, Validators.email ],
63 MESSAGES: { 63 MESSAGES: {
64 'required': $localize`Admin email is required.`, 64 required: $localize`Admin email is required.`,
65 'email': $localize`Admin email must be valid.` 65 email: $localize`Admin email must be valid.`
66 } 66 }
67} 67}
68 68
69export const TRANSCODING_THREADS_VALIDATOR: BuildFormValidator = { 69export const TRANSCODING_THREADS_VALIDATOR: BuildFormValidator = {
70 VALIDATORS: [Validators.required, Validators.min(0)], 70 VALIDATORS: [ Validators.required, Validators.min(0) ],
71 MESSAGES: { 71 MESSAGES: {
72 'required': $localize`Transcoding threads is required.`, 72 required: $localize`Transcoding threads is required.`,
73 'min': $localize`Transcoding threads must be greater or equal to 0.` 73 min: $localize`Transcoding threads must be greater or equal to 0.`
74 } 74 }
75} 75}
76 76
77export const MAX_LIVE_DURATION_VALIDATOR: BuildFormValidator = { 77export const MAX_LIVE_DURATION_VALIDATOR: BuildFormValidator = {
78 VALIDATORS: [Validators.required, Validators.min(-1)], 78 VALIDATORS: [ Validators.required, Validators.min(-1) ],
79 MESSAGES: { 79 MESSAGES: {
80 'required': $localize`Max live duration is required.`, 80 required: $localize`Max live duration is required.`,
81 'min': $localize`Max live duration should be greater or equal to -1.` 81 min: $localize`Max live duration should be greater or equal to -1.`
82 } 82 }
83} 83}
84 84
85export const MAX_INSTANCE_LIVES_VALIDATOR: BuildFormValidator = { 85export const MAX_INSTANCE_LIVES_VALIDATOR: BuildFormValidator = {
86 VALIDATORS: [Validators.required, Validators.min(-1)], 86 VALIDATORS: [ Validators.required, Validators.min(-1) ],
87 MESSAGES: { 87 MESSAGES: {
88 'required': $localize`Max instance lives is required.`, 88 required: $localize`Max instance lives is required.`,
89 'min': $localize`Max instance lives should be greater or equal to -1.` 89 min: $localize`Max instance lives should be greater or equal to -1.`
90 } 90 }
91} 91}
92 92
93export const MAX_USER_LIVES_VALIDATOR: BuildFormValidator = { 93export const MAX_USER_LIVES_VALIDATOR: BuildFormValidator = {
94 VALIDATORS: [Validators.required, Validators.min(-1)], 94 VALIDATORS: [ Validators.required, Validators.min(-1) ],
95 MESSAGES: { 95 MESSAGES: {
96 'required': $localize`Max user lives is required.`, 96 required: $localize`Max user lives is required.`,
97 'min': $localize`Max user lives should be greater or equal to -1.` 97 min: $localize`Max user lives should be greater or equal to -1.`
98 } 98 }
99} 99}
100 100
101export const CONCURRENCY_VALIDATOR: BuildFormValidator = { 101export const CONCURRENCY_VALIDATOR: BuildFormValidator = {
102 VALIDATORS: [Validators.required, Validators.min(1)], 102 VALIDATORS: [ Validators.required, Validators.min(1) ],
103 MESSAGES: { 103 MESSAGES: {
104 'required': $localize`Concurrency is required.`, 104 required: $localize`Concurrency is required.`,
105 'min': $localize`Concurrency should be greater or equal to 1.` 105 min: $localize`Concurrency should be greater or equal to 1.`
106 } 106 }
107} 107}
108 108
109export const INDEX_URL_VALIDATOR: BuildFormValidator = { 109export const INDEX_URL_VALIDATOR: BuildFormValidator = {
110 VALIDATORS: [Validators.pattern(/^https:\/\//)], 110 VALIDATORS: [ Validators.pattern(/^https:\/\//) ],
111 MESSAGES: { 111 MESSAGES: {
112 'pattern': $localize`Index URL should be a URL` 112 pattern: $localize`Index URL should be a URL`
113 } 113 }
114} 114}
115 115
116export const SEARCH_INDEX_URL_VALIDATOR: BuildFormValidator = { 116export const SEARCH_INDEX_URL_VALIDATOR: BuildFormValidator = {
117 VALIDATORS: [Validators.pattern(/^https?:\/\//)], 117 VALIDATORS: [ Validators.pattern(/^https?:\/\//) ],
118 MESSAGES: { 118 MESSAGES: {
119 'pattern': $localize`Search index URL should be a URL` 119 pattern: $localize`Search index URL should be a URL`
120 } 120 }
121} 121}
diff --git a/client/src/app/shared/form-validators/form-validator.model.ts b/client/src/app/shared/form-validators/form-validator.model.ts
index 07b1ea075..6f2472ccd 100644
--- a/client/src/app/shared/form-validators/form-validator.model.ts
+++ b/client/src/app/shared/form-validators/form-validator.model.ts
@@ -1,7 +1,7 @@
1import { ValidatorFn } from '@angular/forms' 1import { ValidatorFn } from '@angular/forms'
2 2
3export type BuildFormValidator = { 3export type BuildFormValidator = {
4 VALIDATORS: ValidatorFn[], 4 VALIDATORS: ValidatorFn[]
5 MESSAGES: { [ name: string ]: string } 5 MESSAGES: { [ name: string ]: string }
6} 6}
7 7
diff --git a/client/src/app/shared/form-validators/host-validators.ts b/client/src/app/shared/form-validators/host-validators.ts
index 6f410a50a..3d9c476b5 100644
--- a/client/src/app/shared/form-validators/host-validators.ts
+++ b/client/src/app/shared/form-validators/host-validators.ts
@@ -4,7 +4,7 @@ import { BuildFormValidator } from './form-validator.model'
4export function validateHost (value: string) { 4export function validateHost (value: string) {
5 // Thanks to http://stackoverflow.com/a/106223 5 // Thanks to http://stackoverflow.com/a/106223
6 const HOST_REGEXP = new RegExp( 6 const HOST_REGEXP = new RegExp(
7 '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$' 7 '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]).)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$'
8 ) 8 )
9 9
10 return HOST_REGEXP.test(value) 10 return HOST_REGEXP.test(value)
@@ -32,7 +32,7 @@ const validHosts: ValidatorFn = (control: AbstractControl) => {
32 if (errors.length === 0) return null 32 if (errors.length === 0) return null
33 33
34 return { 34 return {
35 'validHosts': { 35 validHosts: {
36 reason: 'invalid', 36 reason: 'invalid',
37 value: errors.join('. ') + '.' 37 value: errors.join('. ') + '.'
38 } 38 }
@@ -55,7 +55,7 @@ const validHostsOrHandles: ValidatorFn = (control: AbstractControl) => {
55 if (errors.length === 0) return null 55 if (errors.length === 0) return null
56 56
57 return { 57 return {
58 'validHostsOrHandles': { 58 validHostsOrHandles: {
59 reason: 'invalid', 59 reason: 'invalid',
60 value: errors.join('. ') + '.' 60 value: errors.join('. ') + '.'
61 } 61 }
@@ -80,7 +80,7 @@ export const unique: ValidatorFn = (control: AbstractControl) => {
80 } 80 }
81 81
82 return { 82 return {
83 'unique': { 83 unique: {
84 reason: 'invalid' 84 reason: 'invalid'
85 } 85 }
86 } 86 }
@@ -89,17 +89,17 @@ export const unique: ValidatorFn = (control: AbstractControl) => {
89export const UNIQUE_HOSTS_VALIDATOR: BuildFormValidator = { 89export const UNIQUE_HOSTS_VALIDATOR: BuildFormValidator = {
90 VALIDATORS: [ Validators.required, validHosts, unique ], 90 VALIDATORS: [ Validators.required, validHosts, unique ],
91 MESSAGES: { 91 MESSAGES: {
92 'required': $localize`Domain is required.`, 92 required: $localize`Domain is required.`,
93 'validHosts': $localize`Hosts entered are invalid.`, 93 validHosts: $localize`Hosts entered are invalid.`,
94 'unique': $localize`Hosts entered contain duplicates.` 94 unique: $localize`Hosts entered contain duplicates.`
95 } 95 }
96} 96}
97 97
98export const UNIQUE_HOSTS_OR_HANDLE_VALIDATOR: BuildFormValidator = { 98export const UNIQUE_HOSTS_OR_HANDLE_VALIDATOR: BuildFormValidator = {
99 VALIDATORS: [ Validators.required, validHostsOrHandles, unique ], 99 VALIDATORS: [ Validators.required, validHostsOrHandles, unique ],
100 MESSAGES: { 100 MESSAGES: {
101 'required': $localize`Domain is required.`, 101 required: $localize`Domain is required.`,
102 'validHostsOrHandles': $localize`Hosts or handles are invalid.`, 102 validHostsOrHandles: $localize`Hosts or handles are invalid.`,
103 'unique': $localize`Hosts or handles contain duplicates.` 103 unique: $localize`Hosts or handles contain duplicates.`
104 } 104 }
105} 105}
diff --git a/client/src/app/shared/form-validators/instance-validators.ts b/client/src/app/shared/form-validators/instance-validators.ts
index a72e28ba0..4b1f0d048 100644
--- a/client/src/app/shared/form-validators/instance-validators.ts
+++ b/client/src/app/shared/form-validators/instance-validators.ts
@@ -2,10 +2,10 @@ import { Validators } from '@angular/forms'
2import { BuildFormValidator } from './form-validator.model' 2import { BuildFormValidator } from './form-validator.model'
3 3
4export const FROM_EMAIL_VALIDATOR: BuildFormValidator = { 4export const FROM_EMAIL_VALIDATOR: BuildFormValidator = {
5 VALIDATORS: [Validators.required, Validators.email], 5 VALIDATORS: [ Validators.required, Validators.email ],
6 MESSAGES: { 6 MESSAGES: {
7 'required': $localize`Email is required.`, 7 required: $localize`Email is required.`,
8 'email': $localize`Email must be valid.` 8 email: $localize`Email must be valid.`
9 } 9 }
10} 10}
11 11
@@ -16,9 +16,9 @@ export const FROM_NAME_VALIDATOR: BuildFormValidator = {
16 Validators.maxLength(120) 16 Validators.maxLength(120)
17 ], 17 ],
18 MESSAGES: { 18 MESSAGES: {
19 'required': $localize`Your name is required.`, 19 required: $localize`Your name is required.`,
20 'minlength': $localize`Your name must be at least 1 character long.`, 20 minlength: $localize`Your name must be at least 1 character long.`,
21 'maxlength': $localize`Your name cannot be more than 120 characters long.` 21 maxlength: $localize`Your name cannot be more than 120 characters long.`
22 } 22 }
23} 23}
24 24
@@ -29,9 +29,9 @@ export const SUBJECT_VALIDATOR: BuildFormValidator = {
29 Validators.maxLength(120) 29 Validators.maxLength(120)
30 ], 30 ],
31 MESSAGES: { 31 MESSAGES: {
32 'required': $localize`A subject is required.`, 32 required: $localize`A subject is required.`,
33 'minlength': $localize`The subject must be at least 1 character long.`, 33 minlength: $localize`The subject must be at least 1 character long.`,
34 'maxlength': $localize`The subject cannot be more than 120 characters long.` 34 maxlength: $localize`The subject cannot be more than 120 characters long.`
35 } 35 }
36} 36}
37 37
@@ -42,8 +42,8 @@ export const BODY_VALIDATOR: BuildFormValidator = {
42 Validators.maxLength(5000) 42 Validators.maxLength(5000)
43 ], 43 ],
44 MESSAGES: { 44 MESSAGES: {
45 'required': $localize`A message is required.`, 45 required: $localize`A message is required.`,
46 'minlength': $localize`The message must be at least 3 characters long.`, 46 minlength: $localize`The message must be at least 3 characters long.`,
47 'maxlength': $localize`The message cannot be more than 5000 characters long.` 47 maxlength: $localize`The message cannot be more than 5000 characters long.`
48 } 48 }
49} 49}
diff --git a/client/src/app/shared/form-validators/login-validators.ts b/client/src/app/shared/form-validators/login-validators.ts
index 1ceae1be3..5b911ac47 100644
--- a/client/src/app/shared/form-validators/login-validators.ts
+++ b/client/src/app/shared/form-validators/login-validators.ts
@@ -6,7 +6,7 @@ export const LOGIN_USERNAME_VALIDATOR: BuildFormValidator = {
6 Validators.required 6 Validators.required
7 ], 7 ],
8 MESSAGES: { 8 MESSAGES: {
9 'required': $localize`Username is required.` 9 required: $localize`Username is required.`
10 } 10 }
11} 11}
12 12
@@ -15,6 +15,6 @@ export const LOGIN_PASSWORD_VALIDATOR: BuildFormValidator = {
15 Validators.required 15 Validators.required
16 ], 16 ],
17 MESSAGES: { 17 MESSAGES: {
18 'required': $localize`Password is required.` 18 required: $localize`Password is required.`
19 } 19 }
20} 20}
diff --git a/client/src/app/shared/form-validators/reset-password-validators.ts b/client/src/app/shared/form-validators/reset-password-validators.ts
index b87f2eab9..70617a562 100644
--- a/client/src/app/shared/form-validators/reset-password-validators.ts
+++ b/client/src/app/shared/form-validators/reset-password-validators.ts
@@ -6,6 +6,6 @@ export const RESET_PASSWORD_CONFIRM_VALIDATOR: BuildFormValidator = {
6 Validators.required 6 Validators.required
7 ], 7 ],
8 MESSAGES: { 8 MESSAGES: {
9 'required': $localize`Confirmation of the password is required.` 9 required: $localize`Confirmation of the password is required.`
10 } 10 }
11} 11}
diff --git a/client/src/app/shared/form-validators/user-validators.ts b/client/src/app/shared/form-validators/user-validators.ts
index 976c97b87..6d0dea64e 100644
--- a/client/src/app/shared/form-validators/user-validators.ts
+++ b/client/src/app/shared/form-validators/user-validators.ts
@@ -11,10 +11,10 @@ export const USER_USERNAME_VALIDATOR: BuildFormValidator = {
11 Validators.pattern(new RegExp(`^${USER_USERNAME_REGEX_CHARACTERS}*$`)) 11 Validators.pattern(new RegExp(`^${USER_USERNAME_REGEX_CHARACTERS}*$`))
12 ], 12 ],
13 MESSAGES: { 13 MESSAGES: {
14 'required': $localize`Username is required.`, 14 required: $localize`Username is required.`,
15 'minlength': $localize`Username must be at least 1 character long.`, 15 minlength: $localize`Username must be at least 1 character long.`,
16 'maxlength': $localize`Username cannot be more than 50 characters long.`, 16 maxlength: $localize`Username cannot be more than 50 characters long.`,
17 'pattern': $localize`Username should be lowercase alphanumeric; dots and underscores are allowed.` 17 pattern: $localize`Username should be lowercase alphanumeric; dots and underscores are allowed.`
18 } 18 }
19} 19}
20 20
@@ -26,18 +26,18 @@ export const USER_CHANNEL_NAME_VALIDATOR: BuildFormValidator = {
26 Validators.pattern(/^[a-z0-9][a-z0-9._]*$/) 26 Validators.pattern(/^[a-z0-9][a-z0-9._]*$/)
27 ], 27 ],
28 MESSAGES: { 28 MESSAGES: {
29 'required': $localize`Channel name is required.`, 29 required: $localize`Channel name is required.`,
30 'minlength': $localize`Channel name must be at least 1 character long.`, 30 minlength: $localize`Channel name must be at least 1 character long.`,
31 'maxlength': $localize`Channel name cannot be more than 50 characters long.`, 31 maxlength: $localize`Channel name cannot be more than 50 characters long.`,
32 'pattern': $localize`Channel name should be lowercase, and can contain only alphanumeric characters, dots and underscores.` 32 pattern: $localize`Channel name should be lowercase, and can contain only alphanumeric characters, dots and underscores.`
33 } 33 }
34} 34}
35 35
36export const USER_EMAIL_VALIDATOR: BuildFormValidator = { 36export const USER_EMAIL_VALIDATOR: BuildFormValidator = {
37 VALIDATORS: [ Validators.required, Validators.email ], 37 VALIDATORS: [ Validators.required, Validators.email ],
38 MESSAGES: { 38 MESSAGES: {
39 'required': $localize`Email is required.`, 39 required: $localize`Email is required.`,
40 'email': $localize`Email must be valid.` 40 email: $localize`Email must be valid.`
41 } 41 }
42} 42}
43 43
@@ -47,8 +47,8 @@ export const USER_HANDLE_VALIDATOR: BuildFormValidator = {
47 Validators.pattern(/@.+/) 47 Validators.pattern(/@.+/)
48 ], 48 ],
49 MESSAGES: { 49 MESSAGES: {
50 'required': $localize`Handle is required.`, 50 required: $localize`Handle is required.`,
51 'pattern': $localize`Handle must be valid (eg. chocobozzz@example.com).` 51 pattern: $localize`Handle must be valid (eg. chocobozzz@example.com).`
52 } 52 }
53} 53}
54 54
@@ -57,7 +57,7 @@ export const USER_EXISTING_PASSWORD_VALIDATOR: BuildFormValidator = {
57 Validators.required 57 Validators.required
58 ], 58 ],
59 MESSAGES: { 59 MESSAGES: {
60 'required': $localize`Password is required.` 60 required: $localize`Password is required.`
61 } 61 }
62} 62}
63 63
@@ -68,9 +68,9 @@ export const USER_PASSWORD_VALIDATOR: BuildFormValidator = {
68 Validators.maxLength(255) 68 Validators.maxLength(255)
69 ], 69 ],
70 MESSAGES: { 70 MESSAGES: {
71 'required': $localize`Password is required.`, 71 required: $localize`Password is required.`,
72 'minlength': $localize`Password must be at least 6 characters long.`, 72 minlength: $localize`Password must be at least 6 characters long.`,
73 'maxlength': $localize`Password cannot be more than 255 characters long.` 73 maxlength: $localize`Password cannot be more than 255 characters long.`
74 } 74 }
75} 75}
76 76
@@ -80,37 +80,37 @@ export const USER_PASSWORD_OPTIONAL_VALIDATOR: BuildFormValidator = {
80 Validators.maxLength(255) 80 Validators.maxLength(255)
81 ], 81 ],
82 MESSAGES: { 82 MESSAGES: {
83 'minlength': $localize`Password must be at least 6 characters long.`, 83 minlength: $localize`Password must be at least 6 characters long.`,
84 'maxlength': $localize`Password cannot be more than 255 characters long.` 84 maxlength: $localize`Password cannot be more than 255 characters long.`
85 } 85 }
86} 86}
87 87
88export const USER_CONFIRM_PASSWORD_VALIDATOR: BuildFormValidator = { 88export const USER_CONFIRM_PASSWORD_VALIDATOR: BuildFormValidator = {
89 VALIDATORS: [], 89 VALIDATORS: [],
90 MESSAGES: { 90 MESSAGES: {
91 'matchPassword': $localize`The new password and the confirmed password do not correspond.` 91 matchPassword: $localize`The new password and the confirmed password do not correspond.`
92 } 92 }
93} 93}
94 94
95export const USER_VIDEO_QUOTA_VALIDATOR: BuildFormValidator = { 95export const USER_VIDEO_QUOTA_VALIDATOR: BuildFormValidator = {
96 VALIDATORS: [ Validators.required, Validators.min(-1) ], 96 VALIDATORS: [ Validators.required, Validators.min(-1) ],
97 MESSAGES: { 97 MESSAGES: {
98 'required': $localize`Video quota is required.`, 98 required: $localize`Video quota is required.`,
99 'min': $localize`Quota must be greater than -1.` 99 min: $localize`Quota must be greater than -1.`
100 } 100 }
101} 101}
102export const USER_VIDEO_QUOTA_DAILY_VALIDATOR: BuildFormValidator = { 102export const USER_VIDEO_QUOTA_DAILY_VALIDATOR: BuildFormValidator = {
103 VALIDATORS: [ Validators.required, Validators.min(-1) ], 103 VALIDATORS: [ Validators.required, Validators.min(-1) ],
104 MESSAGES: { 104 MESSAGES: {
105 'required': $localize`Daily upload limit is required.`, 105 required: $localize`Daily upload limit is required.`,
106 'min': $localize`Daily upload limit must be greater than -1.` 106 min: $localize`Daily upload limit must be greater than -1.`
107 } 107 }
108} 108}
109 109
110export const USER_ROLE_VALIDATOR: BuildFormValidator = { 110export const USER_ROLE_VALIDATOR: BuildFormValidator = {
111 VALIDATORS: [ Validators.required ], 111 VALIDATORS: [ Validators.required ],
112 MESSAGES: { 112 MESSAGES: {
113 'required': $localize`User role is required.` 113 required: $localize`User role is required.`
114 } 114 }
115} 115}
116 116
@@ -122,15 +122,15 @@ export const USER_DESCRIPTION_VALIDATOR: BuildFormValidator = {
122 Validators.maxLength(1000) 122 Validators.maxLength(1000)
123 ], 123 ],
124 MESSAGES: { 124 MESSAGES: {
125 'minlength': $localize`Description must be at least 3 characters long.`, 125 minlength: $localize`Description must be at least 3 characters long.`,
126 'maxlength': $localize`Description cannot be more than 1000 characters long.` 126 maxlength: $localize`Description cannot be more than 1000 characters long.`
127 } 127 }
128} 128}
129 129
130export const USER_TERMS_VALIDATOR: BuildFormValidator = { 130export const USER_TERMS_VALIDATOR: BuildFormValidator = {
131 VALIDATORS: [ Validators.requiredTrue ], 131 VALIDATORS: [ Validators.requiredTrue ],
132 MESSAGES: { 132 MESSAGES: {
133 'required': $localize`You must agree with the instance terms in order to register on it.` 133 required: $localize`You must agree with the instance terms in order to register on it.`
134 } 134 }
135} 135}
136 136
@@ -140,8 +140,8 @@ export const USER_BAN_REASON_VALIDATOR: BuildFormValidator = {
140 Validators.maxLength(250) 140 Validators.maxLength(250)
141 ], 141 ],
142 MESSAGES: { 142 MESSAGES: {
143 'minlength': $localize`Ban reason must be at least 3 characters long.`, 143 minlength: $localize`Ban reason must be at least 3 characters long.`,
144 'maxlength': $localize`Ban reason cannot be more than 250 characters long.` 144 maxlength: $localize`Ban reason cannot be more than 250 characters long.`
145 } 145 }
146} 146}
147 147
@@ -152,9 +152,9 @@ function buildDisplayNameValidator (required: boolean) {
152 Validators.maxLength(120) 152 Validators.maxLength(120)
153 ], 153 ],
154 MESSAGES: { 154 MESSAGES: {
155 'required': $localize`Display name is required.`, 155 required: $localize`Display name is required.`,
156 'minlength': $localize`Display name must be at least 1 character long.`, 156 minlength: $localize`Display name must be at least 1 character long.`,
157 'maxlength': $localize`Display name cannot be more than 50 characters long.` 157 maxlength: $localize`Display name cannot be more than 50 characters long.`
158 } 158 }
159 } 159 }
160 160
diff --git a/client/src/app/shared/form-validators/video-block-validators.ts b/client/src/app/shared/form-validators/video-block-validators.ts
index d3974aefe..cd2791b76 100644
--- a/client/src/app/shared/form-validators/video-block-validators.ts
+++ b/client/src/app/shared/form-validators/video-block-validators.ts
@@ -4,7 +4,7 @@ import { BuildFormValidator } from './form-validator.model'
4export const VIDEO_BLOCK_REASON_VALIDATOR: BuildFormValidator = { 4export const VIDEO_BLOCK_REASON_VALIDATOR: BuildFormValidator = {
5 VALIDATORS: [ Validators.minLength(2), Validators.maxLength(300) ], 5 VALIDATORS: [ Validators.minLength(2), Validators.maxLength(300) ],
6 MESSAGES: { 6 MESSAGES: {
7 'minlength': $localize`Block reason must be at least 2 characters long.`, 7 minlength: $localize`Block reason must be at least 2 characters long.`,
8 'maxlength': $localize`Block reason cannot be more than 300 characters long.` 8 maxlength: $localize`Block reason cannot be more than 300 characters long.`
9 } 9 }
10} 10}
diff --git a/client/src/app/shared/form-validators/video-captions-validators.ts b/client/src/app/shared/form-validators/video-captions-validators.ts
index 9742d2925..a16216422 100644
--- a/client/src/app/shared/form-validators/video-captions-validators.ts
+++ b/client/src/app/shared/form-validators/video-captions-validators.ts
@@ -4,13 +4,13 @@ import { BuildFormValidator } from './form-validator.model'
4export const VIDEO_CAPTION_LANGUAGE_VALIDATOR: BuildFormValidator = { 4export const VIDEO_CAPTION_LANGUAGE_VALIDATOR: BuildFormValidator = {
5 VALIDATORS: [ Validators.required ], 5 VALIDATORS: [ Validators.required ],
6 MESSAGES: { 6 MESSAGES: {
7 'required': $localize`Video caption language is required.` 7 required: $localize`Video caption language is required.`
8 } 8 }
9} 9}
10 10
11export const VIDEO_CAPTION_FILE_VALIDATOR: BuildFormValidator = { 11export const VIDEO_CAPTION_FILE_VALIDATOR: BuildFormValidator = {
12 VALIDATORS: [ Validators.required ], 12 VALIDATORS: [ Validators.required ],
13 MESSAGES: { 13 MESSAGES: {
14 'required': $localize`Video caption file is required.` 14 required: $localize`Video caption file is required.`
15 } 15 }
16} 16}
diff --git a/client/src/app/shared/form-validators/video-channel-validators.ts b/client/src/app/shared/form-validators/video-channel-validators.ts
index ba502ed01..48f5b1a2c 100644
--- a/client/src/app/shared/form-validators/video-channel-validators.ts
+++ b/client/src/app/shared/form-validators/video-channel-validators.ts
@@ -7,10 +7,10 @@ export const VIDEO_CHANNEL_NAME_VALIDATOR: BuildFormValidator = {
7 VALIDATORS: USER_USERNAME_VALIDATOR.VALIDATORS, 7 VALIDATORS: USER_USERNAME_VALIDATOR.VALIDATORS,
8 8
9 MESSAGES: { 9 MESSAGES: {
10 'required': $localize`Name is required.`, 10 required: $localize`Name is required.`,
11 'minlength': $localize`Name must be at least 1 character long.`, 11 minlength: $localize`Name must be at least 1 character long.`,
12 'maxlength': $localize`Name cannot be more than 50 characters 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.` 13 pattern: $localize`Name should be lowercase alphanumeric; dots and underscores are allowed.`
14 } 14 }
15} 15}
16 16
@@ -21,9 +21,9 @@ export const VIDEO_CHANNEL_DISPLAY_NAME_VALIDATOR: BuildFormValidator = {
21 Validators.maxLength(50) 21 Validators.maxLength(50)
22 ], 22 ],
23 MESSAGES: { 23 MESSAGES: {
24 'required': $localize`Display name is required.`, 24 required: $localize`Display name is required.`,
25 'minlength': $localize`Display name must be at least 1 character long.`, 25 minlength: $localize`Display name must be at least 1 character long.`,
26 'maxlength': $localize`Display name cannot be more than 50 characters long.` 26 maxlength: $localize`Display name cannot be more than 50 characters long.`
27 } 27 }
28} 28}
29 29
@@ -33,8 +33,8 @@ export const VIDEO_CHANNEL_DESCRIPTION_VALIDATOR: BuildFormValidator = {
33 Validators.maxLength(1000) 33 Validators.maxLength(1000)
34 ], 34 ],
35 MESSAGES: { 35 MESSAGES: {
36 'minlength': $localize`Description must be at least 3 characters long.`, 36 minlength: $localize`Description must be at least 3 characters long.`,
37 'maxlength': $localize`Description cannot be more than 1000 characters long.` 37 maxlength: $localize`Description cannot be more than 1000 characters long.`
38 } 38 }
39} 39}
40 40
@@ -44,7 +44,7 @@ export const VIDEO_CHANNEL_SUPPORT_VALIDATOR: BuildFormValidator = {
44 Validators.maxLength(1000) 44 Validators.maxLength(1000)
45 ], 45 ],
46 MESSAGES: { 46 MESSAGES: {
47 'minlength': $localize`Support text must be at least 3 characters long.`, 47 minlength: $localize`Support text must be at least 3 characters long.`,
48 'maxlength': $localize`Support text cannot be more than 1000 characters long` 48 maxlength: $localize`Support text cannot be more than 1000 characters long`
49 } 49 }
50} 50}
diff --git a/client/src/app/shared/form-validators/video-comment-validators.ts b/client/src/app/shared/form-validators/video-comment-validators.ts
index c56564d34..9e8f95e7c 100644
--- a/client/src/app/shared/form-validators/video-comment-validators.ts
+++ b/client/src/app/shared/form-validators/video-comment-validators.ts
@@ -4,8 +4,8 @@ import { BuildFormValidator } from './form-validator.model'
4export const VIDEO_COMMENT_TEXT_VALIDATOR: BuildFormValidator = { 4export const VIDEO_COMMENT_TEXT_VALIDATOR: BuildFormValidator = {
5 VALIDATORS: [ Validators.required, Validators.minLength(1), Validators.maxLength(3000) ], 5 VALIDATORS: [ Validators.required, Validators.minLength(1), Validators.maxLength(3000) ],
6 MESSAGES: { 6 MESSAGES: {
7 'required': $localize`Comment is required.`, 7 required: $localize`Comment is required.`,
8 'minlength': $localize`Comment must be at least 2 characters long.`, 8 minlength: $localize`Comment must be at least 2 characters long.`,
9 'maxlength': $localize`Comment cannot be more than 3000 characters long.` 9 maxlength: $localize`Comment cannot be more than 3000 characters long.`
10 } 10 }
11} 11}
diff --git a/client/src/app/shared/form-validators/video-ownership-change-validators.ts b/client/src/app/shared/form-validators/video-ownership-change-validators.ts
index e1a2df8a6..3e7823c49 100644
--- a/client/src/app/shared/form-validators/video-ownership-change-validators.ts
+++ b/client/src/app/shared/form-validators/video-ownership-change-validators.ts
@@ -4,21 +4,21 @@ import { BuildFormValidator } from './form-validator.model'
4export const OWNERSHIP_CHANGE_CHANNEL_VALIDATOR: BuildFormValidator = { 4export const OWNERSHIP_CHANGE_CHANNEL_VALIDATOR: BuildFormValidator = {
5 VALIDATORS: [ Validators.required ], 5 VALIDATORS: [ Validators.required ],
6 MESSAGES: { 6 MESSAGES: {
7 'required': $localize`The channel is required.` 7 required: $localize`The channel is required.`
8 } 8 }
9} 9}
10 10
11export const OWNERSHIP_CHANGE_USERNAME_VALIDATOR: BuildFormValidator = { 11export const OWNERSHIP_CHANGE_USERNAME_VALIDATOR: BuildFormValidator = {
12 VALIDATORS: [ Validators.required, localAccountValidator ], 12 VALIDATORS: [ Validators.required, localAccountValidator ],
13 MESSAGES: { 13 MESSAGES: {
14 'required': $localize`The username is required.`, 14 required: $localize`The username is required.`,
15 'localAccountOnly': $localize`You can only transfer ownership to a local account` 15 localAccountOnly: $localize`You can only transfer ownership to a local account`
16 } 16 }
17} 17}
18 18
19function localAccountValidator (control: AbstractControl): ValidationErrors { 19function localAccountValidator (control: AbstractControl): ValidationErrors {
20 if (control.value.includes('@')) { 20 if (control.value.includes('@')) {
21 return { 'localAccountOnly': true } 21 return { localAccountOnly: true }
22 } 22 }
23 23
24 return null 24 return null
diff --git a/client/src/app/shared/form-validators/video-playlist-validators.ts b/client/src/app/shared/form-validators/video-playlist-validators.ts
index 7e3d29458..63af637a3 100644
--- a/client/src/app/shared/form-validators/video-playlist-validators.ts
+++ b/client/src/app/shared/form-validators/video-playlist-validators.ts
@@ -9,9 +9,9 @@ export const VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR: BuildFormValidator = {
9 Validators.maxLength(120) 9 Validators.maxLength(120)
10 ], 10 ],
11 MESSAGES: { 11 MESSAGES: {
12 'required': $localize`Display name is required.`, 12 required: $localize`Display name is required.`,
13 'minlength': $localize`Display name must be at least 1 character long.`, 13 minlength: $localize`Display name must be at least 1 character long.`,
14 'maxlength': $localize`Display name cannot be more than 120 characters long.` 14 maxlength: $localize`Display name cannot be more than 120 characters long.`
15 } 15 }
16} 16}
17 17
@@ -20,7 +20,7 @@ export const VIDEO_PLAYLIST_PRIVACY_VALIDATOR: BuildFormValidator = {
20 Validators.required 20 Validators.required
21 ], 21 ],
22 MESSAGES: { 22 MESSAGES: {
23 'required': $localize`Privacy is required.` 23 required: $localize`Privacy is required.`
24 } 24 }
25} 25}
26 26
@@ -30,21 +30,21 @@ export const VIDEO_PLAYLIST_DESCRIPTION_VALIDATOR: BuildFormValidator = {
30 Validators.maxLength(1000) 30 Validators.maxLength(1000)
31 ], 31 ],
32 MESSAGES: { 32 MESSAGES: {
33 'minlength': $localize`Description must be at least 3 characters long.`, 33 minlength: $localize`Description must be at least 3 characters long.`,
34 'maxlength': $localize`Description cannot be more than 1000 characters long.` 34 maxlength: $localize`Description cannot be more than 1000 characters long.`
35 } 35 }
36} 36}
37 37
38export const VIDEO_PLAYLIST_CHANNEL_ID_VALIDATOR: BuildFormValidator = { 38export const VIDEO_PLAYLIST_CHANNEL_ID_VALIDATOR: BuildFormValidator = {
39 VALIDATORS: [], 39 VALIDATORS: [],
40 MESSAGES: { 40 MESSAGES: {
41 'required': $localize`The channel is required when the playlist is public.` 41 required: $localize`The channel is required when the playlist is public.`
42 } 42 }
43} 43}
44 44
45export function setPlaylistChannelValidator (channelControl: AbstractControl, privacy: VideoPlaylistPrivacy) { 45export function setPlaylistChannelValidator (channelControl: AbstractControl, privacy: VideoPlaylistPrivacy) {
46 if (privacy.toString() === VideoPlaylistPrivacy.PUBLIC.toString()) { 46 if (privacy.toString() === VideoPlaylistPrivacy.PUBLIC.toString()) {
47 channelControl.setValidators([Validators.required]) 47 channelControl.setValidators([ Validators.required ])
48 } else { 48 } else {
49 channelControl.setValidators(null) 49 channelControl.setValidators(null)
50 } 50 }
diff --git a/client/src/app/shared/form-validators/video-validators.ts b/client/src/app/shared/form-validators/video-validators.ts
index 1382a7747..f96189aa2 100644
--- a/client/src/app/shared/form-validators/video-validators.ts
+++ b/client/src/app/shared/form-validators/video-validators.ts
@@ -12,17 +12,17 @@ export const trimValidator: ValidatorFn = (control: FormControl) => {
12export const VIDEO_NAME_VALIDATOR: BuildFormValidator = { 12export const VIDEO_NAME_VALIDATOR: BuildFormValidator = {
13 VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(120) ], 13 VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(120) ],
14 MESSAGES: { 14 MESSAGES: {
15 'required': $localize`Video name is required.`, 15 required: $localize`Video name is required.`,
16 'minlength': $localize`Video name must be at least 3 characters long.`, 16 minlength: $localize`Video name must be at least 3 characters long.`,
17 'maxlength': $localize`Video name cannot be more than 120 characters long.`, 17 maxlength: $localize`Video name cannot be more than 120 characters long.`,
18 'spaces': $localize`Video name has leading or trailing whitespace.` 18 spaces: $localize`Video name has leading or trailing whitespace.`
19 } 19 }
20} 20}
21 21
22export const VIDEO_PRIVACY_VALIDATOR: BuildFormValidator = { 22export const VIDEO_PRIVACY_VALIDATOR: BuildFormValidator = {
23 VALIDATORS: [ Validators.required ], 23 VALIDATORS: [ Validators.required ],
24 MESSAGES: { 24 MESSAGES: {
25 'required': $localize`Video privacy is required.` 25 required: $localize`Video privacy is required.`
26 } 26 }
27} 27}
28 28
@@ -49,46 +49,46 @@ export const VIDEO_IMAGE_VALIDATOR: BuildFormValidator = {
49export const VIDEO_CHANNEL_VALIDATOR: BuildFormValidator = { 49export const VIDEO_CHANNEL_VALIDATOR: BuildFormValidator = {
50 VALIDATORS: [ Validators.required ], 50 VALIDATORS: [ Validators.required ],
51 MESSAGES: { 51 MESSAGES: {
52 'required': $localize`Video channel is required.` 52 required: $localize`Video channel is required.`
53 } 53 }
54} 54}
55 55
56export const VIDEO_DESCRIPTION_VALIDATOR: BuildFormValidator = { 56export const VIDEO_DESCRIPTION_VALIDATOR: BuildFormValidator = {
57 VALIDATORS: [ Validators.minLength(3), Validators.maxLength(10000) ], 57 VALIDATORS: [ Validators.minLength(3), Validators.maxLength(10000) ],
58 MESSAGES: { 58 MESSAGES: {
59 'minlength': $localize`Video description must be at least 3 characters long.`, 59 minlength: $localize`Video description must be at least 3 characters long.`,
60 'maxlength': $localize`Video description cannot be more than 10000 characters long.` 60 maxlength: $localize`Video description cannot be more than 10000 characters long.`
61 } 61 }
62} 62}
63 63
64export const VIDEO_TAG_VALIDATOR: BuildFormValidator = { 64export const VIDEO_TAG_VALIDATOR: BuildFormValidator = {
65 VALIDATORS: [ Validators.minLength(2), Validators.maxLength(30) ], 65 VALIDATORS: [ Validators.minLength(2), Validators.maxLength(30) ],
66 MESSAGES: { 66 MESSAGES: {
67 'minlength': $localize`A tag should be more than 2 characters long.`, 67 minlength: $localize`A tag should be more than 2 characters long.`,
68 'maxlength': $localize`A tag should be less than 30 characters long.` 68 maxlength: $localize`A tag should be less than 30 characters long.`
69 } 69 }
70} 70}
71 71
72export const VIDEO_TAGS_ARRAY_VALIDATOR: BuildFormValidator = { 72export const VIDEO_TAGS_ARRAY_VALIDATOR: BuildFormValidator = {
73 VALIDATORS: [ Validators.maxLength(5), arrayTagLengthValidator() ], 73 VALIDATORS: [ Validators.maxLength(5), arrayTagLengthValidator() ],
74 MESSAGES: { 74 MESSAGES: {
75 'maxlength': $localize`A maximum of 5 tags can be used on a video.`, 75 maxlength: $localize`A maximum of 5 tags can be used on a video.`,
76 'arrayTagLength': $localize`A tag should be more than 1 and less than 30 characters long.` 76 arrayTagLength: $localize`A tag should be more than 1 and less than 30 characters long.`
77 } 77 }
78} 78}
79 79
80export const VIDEO_SUPPORT_VALIDATOR: BuildFormValidator = { 80export const VIDEO_SUPPORT_VALIDATOR: BuildFormValidator = {
81 VALIDATORS: [ Validators.minLength(3), Validators.maxLength(1000) ], 81 VALIDATORS: [ Validators.minLength(3), Validators.maxLength(1000) ],
82 MESSAGES: { 82 MESSAGES: {
83 'minlength': $localize`Video support must be at least 3 characters long.`, 83 minlength: $localize`Video support must be at least 3 characters long.`,
84 'maxlength': $localize`Video support cannot be more than 1000 characters long.` 84 maxlength: $localize`Video support cannot be more than 1000 characters long.`
85 } 85 }
86} 86}
87 87
88export const VIDEO_SCHEDULE_PUBLICATION_AT_VALIDATOR: BuildFormValidator = { 88export const VIDEO_SCHEDULE_PUBLICATION_AT_VALIDATOR: BuildFormValidator = {
89 VALIDATORS: [ ], 89 VALIDATORS: [ ],
90 MESSAGES: { 90 MESSAGES: {
91 'required': $localize`A date is required to schedule video update.` 91 required: $localize`A date is required to schedule video update.`
92 } 92 }
93} 93}
94 94
@@ -105,6 +105,6 @@ function arrayTagLengthValidator (min = 2, max = 30): ValidatorFn {
105 return null 105 return null
106 } 106 }
107 107
108 return { 'arrayTagLength': true } 108 return { arrayTagLength: true }
109 } 109 }
110} 110}