aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/video-watch.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-14 09:08:47 +0200
committerChocobozzz <me@florianbigard.com>2018-08-14 09:27:18 +0200
commit191764f30b0a812bf3a9dbdc7daf1d5afe25e12a (patch)
treea5592f8d89949cde832f025e393a3821ad2aca37 /client/src/app/videos/+video-watch/video-watch.component.ts
parent26b7305a232e547709f433a6edf700bf495935d8 (diff)
downloadPeerTube-191764f30b0a812bf3a9dbdc7daf1d5afe25e12a.tar.gz
PeerTube-191764f30b0a812bf3a9dbdc7daf1d5afe25e12a.tar.zst
PeerTube-191764f30b0a812bf3a9dbdc7daf1d5afe25e12a.zip
Improve blacklist management
Diffstat (limited to 'client/src/app/videos/+video-watch/video-watch.component.ts')
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts32
1 files changed, 31 insertions, 1 deletions
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts
index 878655d4a..bea13ec99 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -121,7 +121,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
121 this.videoCaptionService.listCaptions(uuid) 121 this.videoCaptionService.listCaptions(uuid)
122 ) 122 )
123 .pipe( 123 .pipe(
124 catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ])) 124 // If 401, the video is private or blacklisted so redirect to 404
125 catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 401, 404 ]))
125 ) 126 )
126 .subscribe(([ video, captionsResult ]) => { 127 .subscribe(([ video, captionsResult ]) => {
127 const startTime = this.route.snapshot.queryParams.start 128 const startTime = this.route.snapshot.queryParams.start
@@ -217,6 +218,31 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
217 this.videoBlacklistModal.show() 218 this.videoBlacklistModal.show()
218 } 219 }
219 220
221 async unblacklistVideo (event: Event) {
222 event.preventDefault()
223
224 const confirmMessage = this.i18n(
225 'Do you really want to remove this video from the blacklist? It will be available again in the videos list.'
226 )
227
228 const res = await this.confirmService.confirm(confirmMessage, this.i18n('Unblacklist'))
229 if (res === false) return
230
231 this.videoBlacklistService.removeVideoFromBlacklist(this.video.id).subscribe(
232 () => {
233 this.notificationsService.success(
234 this.i18n('Success'),
235 this.i18n('Video {{name}} removed from the blacklist.', { name: this.video.name })
236 )
237
238 this.video.blacklisted = false
239 this.video.blacklistedReason = null
240 },
241
242 err => this.notificationsService.error(this.i18n('Error'), err.message)
243 )
244 }
245
220 isUserLoggedIn () { 246 isUserLoggedIn () {
221 return this.authService.isLoggedIn() 247 return this.authService.isLoggedIn()
222 } 248 }
@@ -229,6 +255,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
229 return this.video.isBlackistableBy(this.user) 255 return this.video.isBlackistableBy(this.user)
230 } 256 }
231 257
258 isVideoUnblacklistable () {
259 return this.video.isUnblacklistableBy(this.user)
260 }
261
232 getVideoPoster () { 262 getVideoPoster () {
233 if (!this.video) return '' 263 if (!this.video) return ''
234 264