aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared')
-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
-rw-r--r--client/src/app/shared/shared.module.ts5
-rw-r--r--client/src/app/shared/video-blacklist/video-blacklist.service.ts6
-rw-r--r--client/src/app/shared/video/video-details.model.ts2
5 files changed, 28 insertions, 5 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}
diff --git a/client/src/app/shared/shared.module.ts b/client/src/app/shared/shared.module.ts
index ea7f2c887..722415a06 100644
--- a/client/src/app/shared/shared.module.ts
+++ b/client/src/app/shared/shared.module.ts
@@ -36,7 +36,7 @@ import {
36 ReactiveFileComponent, 36 ReactiveFileComponent,
37 ResetPasswordValidatorsService, 37 ResetPasswordValidatorsService,
38 UserValidatorsService, 38 UserValidatorsService,
39 VideoAbuseValidatorsService, 39 VideoAbuseValidatorsService, VideoBlacklistValidatorsService,
40 VideoChannelValidatorsService, 40 VideoChannelValidatorsService,
41 VideoCommentValidatorsService, 41 VideoCommentValidatorsService,
42 VideoValidatorsService 42 VideoValidatorsService
@@ -133,6 +133,7 @@ import { NgbDropdownModule, NgbModalModule, NgbPopoverModule, NgbTabsetModule, N
133 MarkdownService, 133 MarkdownService,
134 VideoChannelService, 134 VideoChannelService,
135 VideoCaptionService, 135 VideoCaptionService,
136 VideoImportService,
136 137
137 FormValidatorService, 138 FormValidatorService,
138 CustomConfigValidatorsService, 139 CustomConfigValidatorsService,
@@ -144,7 +145,7 @@ import { NgbDropdownModule, NgbModalModule, NgbPopoverModule, NgbTabsetModule, N
144 VideoCommentValidatorsService, 145 VideoCommentValidatorsService,
145 VideoValidatorsService, 146 VideoValidatorsService,
146 VideoCaptionsValidatorsService, 147 VideoCaptionsValidatorsService,
147 VideoImportService, 148 VideoBlacklistValidatorsService,
148 149
149 I18nPrimengCalendarService, 150 I18nPrimengCalendarService,
150 ScreenService, 151 ScreenService,
diff --git a/client/src/app/shared/video-blacklist/video-blacklist.service.ts b/client/src/app/shared/video-blacklist/video-blacklist.service.ts
index 040d82c9a..a014260b1 100644
--- a/client/src/app/shared/video-blacklist/video-blacklist.service.ts
+++ b/client/src/app/shared/video-blacklist/video-blacklist.service.ts
@@ -36,8 +36,10 @@ export class VideoBlacklistService {
36 ) 36 )
37 } 37 }
38 38
39 blacklistVideo (videoId: number) { 39 blacklistVideo (videoId: number, reason?: string) {
40 return this.authHttp.post(VideoBlacklistService.BASE_VIDEOS_URL + videoId + '/blacklist', {}) 40 const body = reason ? { reason } : {}
41
42 return this.authHttp.post(VideoBlacklistService.BASE_VIDEOS_URL + videoId + '/blacklist', body)
41 .pipe( 43 .pipe(
42 map(this.restExtractor.extractDataBool), 44 map(this.restExtractor.extractDataBool),
43 catchError(res => this.restExtractor.handleError(res)) 45 catchError(res => this.restExtractor.handleError(res))
diff --git a/client/src/app/shared/video/video-details.model.ts b/client/src/app/shared/video/video-details.model.ts
index e500ad6fc..bdcc0bbba 100644
--- a/client/src/app/shared/video/video-details.model.ts
+++ b/client/src/app/shared/video/video-details.model.ts
@@ -44,7 +44,7 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
44 } 44 }
45 45
46 isBlackistableBy (user: AuthUser) { 46 isBlackistableBy (user: AuthUser) {
47 return user && user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) === true && this.isLocal === false 47 return user && user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) === true
48 } 48 }
49 49
50 isUpdatableBy (user: AuthUser) { 50 isUpdatableBy (user: AuthUser) {