aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/forms/form-validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-13 16:57:13 +0200
committerChocobozzz <me@florianbigard.com>2018-08-14 09:27:18 +0200
commit26b7305a232e547709f433a6edf700bf495935d8 (patch)
treeb5676090c61df72f864735bcc881d5ee256cffbd /client/src/app/shared/forms/form-validators
parentefc9e8450a8bbeeef9cd18e3ad6037abc0f815c3 (diff)
downloadPeerTube-26b7305a232e547709f433a6edf700bf495935d8.tar.gz
PeerTube-26b7305a232e547709f433a6edf700bf495935d8.tar.zst
PeerTube-26b7305a232e547709f433a6edf700bf495935d8.zip
Add blacklist reason field
Diffstat (limited to 'client/src/app/shared/forms/form-validators')
-rw-r--r--client/src/app/shared/forms/form-validators/index.ts1
-rw-r--r--client/src/app/shared/forms/form-validators/video-blacklist-validators.service.ts19
2 files changed, 20 insertions, 0 deletions
diff --git a/client/src/app/shared/forms/form-validators/index.ts b/client/src/app/shared/forms/form-validators/index.ts
index 60d735ef7..9bc7615ca 100644
--- a/client/src/app/shared/forms/form-validators/index.ts
+++ b/client/src/app/shared/forms/form-validators/index.ts
@@ -5,6 +5,7 @@ export * from './login-validators.service'
5export * from './reset-password-validators.service' 5export * from './reset-password-validators.service'
6export * from './user-validators.service' 6export * from './user-validators.service'
7export * from './video-abuse-validators.service' 7export * from './video-abuse-validators.service'
8export * from './video-blacklist-validators.service'
8export * from './video-channel-validators.service' 9export * from './video-channel-validators.service'
9export * from './video-comment-validators.service' 10export * from './video-comment-validators.service'
10export * from './video-validators.service' 11export * from './video-validators.service'
diff --git a/client/src/app/shared/forms/form-validators/video-blacklist-validators.service.ts b/client/src/app/shared/forms/form-validators/video-blacklist-validators.service.ts
new file mode 100644
index 000000000..07d1f264a
--- /dev/null
+++ b/client/src/app/shared/forms/form-validators/video-blacklist-validators.service.ts
@@ -0,0 +1,19 @@
1import { I18n } from '@ngx-translate/i18n-polyfill'
2import { Validators } from '@angular/forms'
3import { Injectable } from '@angular/core'
4import { BuildFormValidator } from '@app/shared'
5
6@Injectable()
7export class VideoBlacklistValidatorsService {
8 readonly VIDEO_BLACKLIST_REASON: BuildFormValidator
9
10 constructor (private i18n: I18n) {
11 this.VIDEO_BLACKLIST_REASON = {
12 VALIDATORS: [ Validators.minLength(2), Validators.maxLength(300) ],
13 MESSAGES: {
14 'minlength': this.i18n('Blacklist reason must be at least 2 characters long.'),
15 'maxlength': this.i18n('Blacklist reason cannot be more than 300 characters long.')
16 }
17 }
18 }
19}