]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+videos/+video-watch/shared/action-buttons/video-rate.component.ts
Fix fetching unlisted video in client
[github/Chocobozzz/PeerTube.git] / client / src / app / +videos / +video-watch / shared / action-buttons / video-rate.component.ts
index ecb5a9281100c52b1bb9a996212c147f6cc6c292..0fef246b372f11fb5c9b4a2f653dd18b18d0d647 100644 (file)
@@ -89,37 +89,37 @@ export class VideoRateComponent implements OnInit, OnChanges, OnDestroy {
     // Unlogged users do not have ratings
     if (this.isUserLoggedIn === false) return
 
-    this.videoService.getUserVideoRating(this.video.id)
-        .subscribe(
-          ratingObject => {
+    this.videoService.getUserVideoRating(this.video.uuid)
+        .subscribe({
+          next: ratingObject => {
             if (!ratingObject) return
 
             this.userRating = ratingObject.rating
             this.userRatingLoaded.emit(this.userRating)
           },
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 
   private setRating (nextRating: UserVideoRateType) {
-    const ratingMethods: { [id in UserVideoRateType]: (id: number) => Observable<any> } = {
+    const ratingMethods: { [id in UserVideoRateType]: (id: string) => Observable<any> } = {
       like: this.videoService.setVideoLike,
       dislike: this.videoService.setVideoDislike,
       none: this.videoService.unsetVideoLike
     }
 
-    ratingMethods[nextRating].call(this.videoService, this.video.id)
-          .subscribe(
-            () => {
+    ratingMethods[nextRating].call(this.videoService, this.video.uuid)
+          .subscribe({
+            next: () => {
               // Update the video like attribute
               this.updateVideoRating(this.userRating, nextRating)
               this.userRating = nextRating
               this.rateUpdated.emit(this.userRating)
             },
 
-            (err: { message: string }) => this.notifier.error(err.message)
-          )
+            error: err => this.notifier.error(err.message)
+          })
   }
 
   private updateVideoRating (oldRating: UserVideoRateType, newRating: UserVideoRateType) {