]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/video-watch/video-watch.component.ts
Format video blacklist
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-watch / video-watch.component.ts
index e04626a677f9c70225c20bc6b898c5cd06f70f08..07b2a1d1f30736f80823c0683500901bef2ef8dc 100644 (file)
@@ -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();
@@ -192,6 +233,14 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
            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;