diff options
author | Chocobozzz <me@florianbigard.com> | 2020-07-01 16:05:30 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-07-10 14:02:41 +0200 |
commit | d95d15598847c7f020aa056e7e6e0c02d2bbf732 (patch) | |
tree | a8a593f1269688caf9e5f99559996f346290fec5 /client/src/app/shared/shared-forms/form-validators/abuse-validators.service.ts | |
parent | 72493e44e9b455a04c4f093ed6c6ffa300b98d8b (diff) | |
download | PeerTube-d95d15598847c7f020aa056e7e6e0c02d2bbf732.tar.gz PeerTube-d95d15598847c7f020aa056e7e6e0c02d2bbf732.tar.zst PeerTube-d95d15598847c7f020aa056e7e6e0c02d2bbf732.zip |
Use 3 tables to represent abuses
Diffstat (limited to 'client/src/app/shared/shared-forms/form-validators/abuse-validators.service.ts')
-rw-r--r-- | client/src/app/shared/shared-forms/form-validators/abuse-validators.service.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/client/src/app/shared/shared-forms/form-validators/abuse-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/abuse-validators.service.ts new file mode 100644 index 000000000..739115e19 --- /dev/null +++ b/client/src/app/shared/shared-forms/form-validators/abuse-validators.service.ts | |||
@@ -0,0 +1,30 @@ | |||
1 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
2 | import { Validators } from '@angular/forms' | ||
3 | import { Injectable } from '@angular/core' | ||
4 | import { BuildFormValidator } from './form-validator.service' | ||
5 | |||
6 | @Injectable() | ||
7 | export class AbuseValidatorsService { | ||
8 | readonly ABUSE_REASON: BuildFormValidator | ||
9 | readonly ABUSE_MODERATION_COMMENT: BuildFormValidator | ||
10 | |||
11 | constructor (private i18n: I18n) { | ||
12 | this.ABUSE_REASON = { | ||
13 | VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ], | ||
14 | MESSAGES: { | ||
15 | 'required': this.i18n('Report reason is required.'), | ||
16 | 'minlength': this.i18n('Report reason must be at least 2 characters long.'), | ||
17 | 'maxlength': this.i18n('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': this.i18n('Moderation comment is required.'), | ||
25 | 'minlength': this.i18n('Moderation comment must be at least 2 characters long.'), | ||
26 | 'maxlength': this.i18n('Moderation comment cannot be more than 3000 characters long.') | ||
27 | } | ||
28 | } | ||
29 | } | ||
30 | } | ||