]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix fetching unlisted video in client
authorChocobozzz <me@florianbigard.com>
Fri, 24 Jun 2022 12:47:32 +0000 (14:47 +0200)
committerChocobozzz <me@florianbigard.com>
Fri, 24 Jun 2022 12:47:32 +0000 (14:47 +0200)
client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts
client/src/app/+videos/+video-edit/video-update.resolver.ts
client/src/app/+videos/+video-watch/shared/action-buttons/video-rate.component.ts
client/src/app/+videos/+video-watch/shared/comment/video-comment-add.component.ts
client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts
client/src/app/shared/shared-main/video-caption/video-caption.service.ts
client/src/app/shared/shared-main/video/video.service.ts
client/src/app/shared/shared-video-comment/video-comment.service.ts

index 0c78669c127a0da8309d64ff0f374d3034399f77..4c74eda845fffc60dccc658b0001044b0f6c1765 100644 (file)
@@ -78,7 +78,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterV
         .pipe(
           switchMap(res => {
             return this.videoCaptionService
-                .listCaptions(res.video.id)
+                .listCaptions(res.video.uuid)
                 .pipe(
                   map(result => ({ video: res.video, videoCaptions: result.data }))
                 )
index db5017340cc548800ad0abe15a206d3a6282c0c6..524ceae109ff30e52ca614056054c81d7a0a5483 100644 (file)
@@ -39,7 +39,7 @@ export class VideoUpdateResolver implements Resolve<any> {
       listUserChannelsForSelect(this.authService),
 
       this.videoCaptionService
-        .listCaptions(video.id)
+        .listCaptions(video.uuid)
         .pipe(
           map(result => result.data)
         ),
index 48d48f33f41320f6b247a46b107b4be8f766b74d..0fef246b372f11fb5c9b4a2f653dd18b18d0d647 100644 (file)
@@ -89,7 +89,7 @@ export class VideoRateComponent implements OnInit, OnChanges, OnDestroy {
     // Unlogged users do not have ratings
     if (this.isUserLoggedIn === false) return
 
-    this.videoService.getUserVideoRating(this.video.id)
+    this.videoService.getUserVideoRating(this.video.uuid)
         .subscribe({
           next: ratingObject => {
             if (!ratingObject) return
@@ -103,13 +103,13 @@ export class VideoRateComponent implements OnInit, OnChanges, OnDestroy {
   }
 
   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)
+    ratingMethods[nextRating].call(this.videoService, this.video.uuid)
           .subscribe({
             next: () => {
               // Update the video like attribute
index 85da83a4c50d9ca95befac36426ffa3146a96a2f..b2aa4cb7bae23b215274adb1ea446a8037368028 100644 (file)
@@ -176,12 +176,12 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges,
 
   private addCommentReply (commentCreate: VideoCommentCreate) {
     return this.videoCommentService
-      .addCommentReply(this.video.id, this.parentComment.id, commentCreate)
+      .addCommentReply(this.video.uuid, this.parentComment.id, commentCreate)
   }
 
   private addCommentThread (commentCreate: VideoCommentCreate) {
     return this.videoCommentService
-      .addCommentThread(this.video.id, commentCreate)
+      .addCommentThread(this.video.uuid, commentCreate)
   }
 
   private initTextValue () {
index 17e0af3bc91797a1468683cbaf9e816ac523a338..8e556c58f6ef3bb88a4b9fabec4df99d00d1a4f4 100644 (file)
@@ -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
     }
 
@@ -110,7 +110,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
 
   loadMoreThreads () {
     const params = {
-      videoId: this.video.id,
+      videoId: this.video.uuid,
       componentPagination: this.componentPagination,
       sort: this.sort
     }
index 00ebe5bc6cef785c65d0c23f739b71d77e6612ca..0f3afd116eb6dd11a84455aab045f009c0930947 100644 (file)
@@ -18,7 +18,7 @@ export class VideoCaptionService {
     private restExtractor: RestExtractor
   ) {}
 
-  listCaptions (videoId: number | string): Observable<ResultList<VideoCaption>> {
+  listCaptions (videoId: string): Observable<ResultList<VideoCaption>> {
     return this.authHttp.get<ResultList<VideoCaption>>(`${VideoService.BASE_VIDEO_URL}/${videoId}/captions`)
                .pipe(
                  switchMap(captionsResult => {
index 83bc4eeb6a4e551d452d38dad667497c14e1b363..7810c4303c879ed53ee2ebf86112110969557f2a 100644 (file)
@@ -338,19 +338,19 @@ export class VideoService {
                )
   }
 
-  setVideoLike (id: number) {
+  setVideoLike (id: string) {
     return this.setVideoRate(id, 'like')
   }
 
-  setVideoDislike (id: number) {
+  setVideoDislike (id: string) {
     return this.setVideoRate(id, 'dislike')
   }
 
-  unsetVideoLike (id: number) {
+  unsetVideoLike (id: string) {
     return this.setVideoRate(id, 'none')
   }
 
-  getUserVideoRating (id: number) {
+  getUserVideoRating (id: string) {
     const url = UserService.BASE_USERS_URL + 'me/videos/' + id + '/rating'
 
     return this.authHttp.get<UserVideoRate>(url)
@@ -466,7 +466,7 @@ export class VideoService {
     }
   }
 
-  private setVideoRate (id: number, rateType: UserVideoRateType) {
+  private setVideoRate (id: string, rateType: UserVideoRateType) {
     const url = `${VideoService.BASE_VIDEO_URL}/${id}/rate`
     const body: UserVideoRateUpdate = {
       rating: rateType
index 6f2ef50cb0d09032d8bef553401a2a894b587a7a..8cd94643a41404c0f2e5ed5ceb9bfe17b57379c1 100644 (file)
@@ -31,7 +31,7 @@ export class VideoCommentService {
     private restService: RestService
   ) {}
 
-  addCommentThread (videoId: number | string, comment: VideoCommentCreate) {
+  addCommentThread (videoId: string, comment: VideoCommentCreate) {
     const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comment-threads'
     const normalizedComment = objectLineFeedToHtml(comment, 'text')
 
@@ -42,7 +42,7 @@ export class VideoCommentService {
                )
   }
 
-  addCommentReply (videoId: number | string, inReplyToCommentId: number, comment: VideoCommentCreate) {
+  addCommentReply (videoId: string, inReplyToCommentId: number, comment: VideoCommentCreate) {
     const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comments/' + inReplyToCommentId
     const normalizedComment = objectLineFeedToHtml(comment, 'text')
 
@@ -75,7 +75,7 @@ export class VideoCommentService {
   }
 
   getVideoCommentThreads (parameters: {
-    videoId: number | string
+    videoId: string
     componentPagination: ComponentPaginationLight
     sort: string
   }): Observable<ThreadsResultList<VideoComment>> {
@@ -95,7 +95,7 @@ export class VideoCommentService {
   }
 
   getVideoThreadComments (parameters: {
-    videoId: number | string
+    videoId: string
     threadId: number
   }): Observable<VideoCommentThreadTree> {
     const { videoId, threadId } = parameters