aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-forms/form-validators/abuse-validators.service.ts
blob: 56d30d6f98944a7aaa23cffc85c5c93f999d4d63 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { Injectable } from '@angular/core'
import { Validators } from '@angular/forms'
import { BuildFormValidator } from './form-validator.service'

@Injectable()
export class AbuseValidatorsService {
  readonly ABUSE_REASON: BuildFormValidator
  readonly ABUSE_MODERATION_COMMENT: BuildFormValidator
  readonly ABUSE_MESSAGE: BuildFormValidator

  constructor () {
    this.ABUSE_REASON = {
      VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ],
      MESSAGES: {
        'required': $localize`Report reason is required.`,
        'minlength': $localize`Report reason must be at least 2 characters long.`,
        'maxlength': $localize`Report reason cannot be more than 3000 characters long.`
      }
    }

    this.ABUSE_MODERATION_COMMENT = {
      VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ],
      MESSAGES: {
        'required': $localize`Moderation comment is required.`,
        'minlength': $localize`Moderation comment must be at least 2 characters long.`,
        'maxlength': $localize`Moderation comment cannot be more than 3000 characters long.`
      }
    }

    this.ABUSE_MESSAGE = {
      VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ],
      MESSAGES: {
        'required': $localize`Abuse message is required.`,
        'minlength': $localize`Abuse message must be at least 2 characters long.`,
        'maxlength': $localize`Abuse message cannot be more than 3000 characters long.`
      }
    }
  }
}