]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts
Fix fetching unlisted video in client
[github/Chocobozzz/PeerTube.git] / client / src / app / +videos / +video-watch / shared / comment / video-comments.component.ts
index 2c39e63fbd372526ef483a604e0a3518000a3f0b..8e556c58f6ef3bb88a4b9fabec4df99d00d1a4f4 100644 (file)
@@ -9,7 +9,7 @@ import { VideoComment, VideoCommentService, VideoCommentThreadTree } from '@app/
 @Component({
   selector: 'my-video-comments',
   templateUrl: './video-comments.component.html',
-  styleUrls: ['./video-comments.component.scss']
+  styleUrls: [ './video-comments.component.scss' ]
 })
 export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
   @ViewChild('commentHighlightBlock') commentHighlightBlock: ElementRef
@@ -78,7 +78,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
     this.threadLoading[commentId] = true
 
     const params = {
-      videoId: this.video.id,
+      videoId: this.video.uuid,
       threadId: commentId
     }
 
@@ -90,27 +90,27 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
       'filter:api.video-watch.video-thread-replies.list.result'
     )
 
-    obs.subscribe(
-        res => {
-          this.threadComments[commentId] = res
-          this.threadLoading[commentId] = false
-          this.hooks.runAction('action:video-watch.video-thread-replies.loaded', 'video-watch', { data: res })
+    obs.subscribe({
+      next: res => {
+        this.threadComments[commentId] = res
+        this.threadLoading[commentId] = false
+        this.hooks.runAction('action:video-watch.video-thread-replies.loaded', 'video-watch', { data: res })
 
-          if (highlightThread) {
-            this.highlightedThread = new VideoComment(res.comment)
+        if (highlightThread) {
+          this.highlightedThread = new VideoComment(res.comment)
 
-            // Scroll to the highlighted thread
-            setTimeout(() => this.commentHighlightBlock.nativeElement.scrollIntoView(), 0)
-          }
-        },
+          // Scroll to the highlighted thread
+          setTimeout(() => this.commentHighlightBlock.nativeElement.scrollIntoView(), 0)
+        }
+      },
 
-        err => this.notifier.error(err.message)
-      )
+      error: err => this.notifier.error(err.message)
+    })
   }
 
   loadMoreThreads () {
     const params = {
-      videoId: this.video.id,
+      videoId: this.video.uuid,
       componentPagination: this.componentPagination,
       sort: this.sort
     }
@@ -123,8 +123,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
       'filter:api.video-watch.video-threads.list.result'
     )
 
-    obs.subscribe(
-      res => {
+    obs.subscribe({
+      next: res => {
         this.comments = this.comments.concat(res.data)
         this.componentPagination.totalItems = res.total
         this.totalNotDeletedComments = res.totalNotDeletedComments
@@ -133,8 +133,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
         this.hooks.runAction('action:video-watch.video-threads.loaded', 'video-watch', { data: this.componentPagination })
       },
 
-      err => this.notifier.error(err.message)
-    )
+      error: err => this.notifier.error(err.message)
+    })
   }
 
   onCommentThreadCreated (comment: VideoComment) {
@@ -181,8 +181,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
     if (res === false) return false
 
     this.videoCommentService.deleteVideoComment(commentToDelete.videoId, commentToDelete.id)
-      .subscribe(
-        () => {
+      .subscribe({
+        next: () => {
           if (this.highlightedThread?.id === commentToDelete.id) {
             commentToDelete = this.comments.find(c => c.id === commentToDelete.id)
 
@@ -193,14 +193,18 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
           this.softDeleteComment(commentToDelete)
         },
 
-        err => this.notifier.error(err.message)
-      )
+        error: err => this.notifier.error(err.message)
+      })
 
     return true
   }
 
   async onWantedToRedraft (commentToRedraft: VideoComment) {
-    const confirm = await this.onWantedToDelete(commentToRedraft, $localize`Delete and re-draft`, $localize`Do you really want to delete and re-draft this comment?`)
+    const confirm = await this.onWantedToDelete(
+      commentToRedraft,
+      $localize`Delete and re-draft`,
+      $localize`Do you really want to delete and re-draft this comment?`
+    )
 
     if (confirm) {
       this.inReplyToCommentId = commentToRedraft.inReplyToCommentId