]>
Commit | Line | Data |
---|---|---|
1 | import { Injectable } from '@angular/core' | |
2 | import { Validators } from '@angular/forms' | |
3 | import { BuildFormValidator } from './form-validator.service' | |
4 | ||
5 | @Injectable() | |
6 | export class AbuseValidatorsService { | |
7 | readonly ABUSE_REASON: BuildFormValidator | |
8 | readonly ABUSE_MODERATION_COMMENT: BuildFormValidator | |
9 | readonly ABUSE_MESSAGE: BuildFormValidator | |
10 | ||
11 | constructor () { | |
12 | this.ABUSE_REASON = { | |
13 | VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ], | |
14 | MESSAGES: { | |
15 | 'required': $localize`Report reason is required.`, | |
16 | 'minlength': $localize`Report reason must be at least 2 characters long.`, | |
17 | 'maxlength': $localize`Report reason cannot be more than 3000 characters long.` | |
18 | } | |
19 | } | |
20 | ||
21 | this.ABUSE_MODERATION_COMMENT = { | |
22 | VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ], | |
23 | MESSAGES: { | |
24 | 'required': $localize`Moderation comment is required.`, | |
25 | 'minlength': $localize`Moderation comment must be at least 2 characters long.`, | |
26 | 'maxlength': $localize`Moderation comment cannot be more than 3000 characters long.` | |
27 | } | |
28 | } | |
29 | ||
30 | this.ABUSE_MESSAGE = { | |
31 | VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ], | |
32 | MESSAGES: { | |
33 | 'required': $localize`Abuse message is required.`, | |
34 | 'minlength': $localize`Abuse message must be at least 2 characters long.`, | |
35 | 'maxlength': $localize`Abuse message cannot be more than 3000 characters long.` | |
36 | } | |
37 | } | |
38 | } | |
39 | } |