]>
Commit | Line | Data |
---|---|---|
e309822b C |
1 | import { I18n } from '@ngx-translate/i18n-polyfill' |
2 | import { Validators } from '@angular/forms' | |
3 | import { Injectable } from '@angular/core' | |
4 | import { BuildFormValidator } from '@app/shared' | |
5 | ||
6 | @Injectable() | |
7 | export class VideoAbuseValidatorsService { | |
8 | readonly VIDEO_ABUSE_REASON: BuildFormValidator | |
efc9e845 | 9 | readonly VIDEO_ABUSE_MODERATION_COMMENT: BuildFormValidator |
e309822b C |
10 | |
11 | constructor (private i18n: I18n) { | |
12 | this.VIDEO_ABUSE_REASON = { | |
1506307f | 13 | VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ], |
e309822b C |
14 | MESSAGES: { |
15 | 'required': this.i18n('Report reason is required.'), | |
16 | 'minlength': this.i18n('Report reason must be at least 2 characters long.'), | |
1506307f | 17 | 'maxlength': this.i18n('Report reason cannot be more than 3000 characters long.') |
e309822b C |
18 | } |
19 | } | |
efc9e845 C |
20 | |
21 | this.VIDEO_ABUSE_MODERATION_COMMENT = { | |
1506307f | 22 | VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ], |
efc9e845 C |
23 | MESSAGES: { |
24 | 'required': this.i18n('Moderation comment is required.'), | |
25 | 'minlength': this.i18n('Moderation comment must be at least 2 characters long.'), | |
1506307f | 26 | 'maxlength': this.i18n('Moderation comment cannot be more than 3000 characters long.') |
efc9e845 C |
27 | } |
28 | } | |
e309822b C |
29 | } |
30 | } |