X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fvideos%2Fvideo-watch%2Fvideo-watch.component.ts;h=07b2a1d1f30736f80823c0683500901bef2ef8dc;hb=ab683a8e0d998cfd9dfb9562d3c616f3e6e1dbfd;hp=37ed70a99f3f62017cf0a9c2b75a9ec1522ec52d;hpb=92fb909c9b4a92a00b0d0da7629e6fb003de281b;p=github%2FChocobozzz%2FPeerTube.git 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 37ed70a99..07b2a1d1f 100644 --- a/client/src/app/videos/video-watch/video-watch.component.ts +++ b/client/src/app/videos/video-watch/video-watch.component.ts @@ -169,6 +169,47 @@ export class VideoWatchComponent implements OnInit, OnDestroy { ); } + removeVideo(event: Event) { + event.preventDefault(); + + this.confirmService.confirm('Do you really want to delete this video?', 'Delete').subscribe( + res => { + if (res === false) return; + + this.videoService.removeVideo(this.video.id) + .subscribe( + status => { + this.notificationsService.success('Success', `Video ${this.video.name} deleted.`); + // Go back to the video-list. + this.router.navigate(['/videos/list']); + }, + + error => this.notificationsService.error('Error', error.text) + ); + } + ); + } + + blacklistVideo(event: Event) { + event.preventDefault(); + + this.confirmService.confirm('Do you really want to blacklist this video ?', 'Blacklist').subscribe( + res => { + if (res === false) return; + + this.videoService.blacklistVideo(this.video.id) + .subscribe( + status => { + this.notificationsService.success('Success', `Video ${this.video.name} had been blacklisted.`); + this.router.navigate(['/videos/list']); + }, + + error => this.notificationsService.error('Error', error.text) + ); + } + ); + } + showReportModal(event: Event) { event.preventDefault(); this.videoReportModal.show(); @@ -187,6 +228,19 @@ export class VideoWatchComponent implements OnInit, OnDestroy { return this.authService.isLoggedIn(); } + canUserUpdateVideo() { + return this.authService.getUser() !== null && + this.authService.getUser().username === this.video.author; + } + + isVideoRemovable() { + return this.video.isRemovableBy(this.authService.getUser()); + } + + isVideoBlacklistable() { + return this.video.isBlackistableBy(this.authService.getUser()); + } + private checkUserRating() { // Unlogged users do not have ratings if (this.isUserLoggedIn() === false) return;