diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-17 14:42:53 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-18 08:35:06 +0200 |
commit | 9df52d660feb722404be00a50f3c8a612bec1c15 (patch) | |
tree | dde52880fa012874d24c60f64eb596b0a789cc8b /client/src/app/shared/form-validators/video-validators.ts | |
parent | adb8809d43648ea0a64d6845bb39aa3bd0e005a6 (diff) | |
download | PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.tar.gz PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.tar.zst PeerTube-9df52d660feb722404be00a50f3c8a612bec1c15.zip |
Migrate client to eslint
Diffstat (limited to 'client/src/app/shared/form-validators/video-validators.ts')
-rw-r--r-- | client/src/app/shared/form-validators/video-validators.ts | 32 |
1 files changed, 16 insertions, 16 deletions
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) => { | |||
12 | export const VIDEO_NAME_VALIDATOR: BuildFormValidator = { | 12 | export 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 | ||
22 | export const VIDEO_PRIVACY_VALIDATOR: BuildFormValidator = { | 22 | export 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 = { | |||
49 | export const VIDEO_CHANNEL_VALIDATOR: BuildFormValidator = { | 49 | export 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 | ||
56 | export const VIDEO_DESCRIPTION_VALIDATOR: BuildFormValidator = { | 56 | export 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 | ||
64 | export const VIDEO_TAG_VALIDATOR: BuildFormValidator = { | 64 | export 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 | ||
72 | export const VIDEO_TAGS_ARRAY_VALIDATOR: BuildFormValidator = { | 72 | export 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 | ||
80 | export const VIDEO_SUPPORT_VALIDATOR: BuildFormValidator = { | 80 | export 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 | ||
88 | export const VIDEO_SCHEDULE_PUBLICATION_AT_VALIDATOR: BuildFormValidator = { | 88 | export 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 | } |