]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts
Merge branch 'release/3.3.0' into develop
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-custom-markup / peertube-custom-tags / videos-list-markup.component.ts
index afa4f47991b08784123baf551befd8f288535644..d9f77802b91e956ed55e9e38ad8d567336aef055 100644 (file)
@@ -23,6 +23,8 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit
   @Input() onlyDisplayTitle: boolean
   @Input() filter: VideoFilter
   @Input() maxRows: number
+  @Input() channelHandle: string
+  @Input() accountHandle: string
 
   @Output() loaded = new EventEmitter<boolean>()
 
@@ -66,6 +68,16 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit
       }
     }
 
+    return this.getVideosObservable()
+      .pipe(finalize(() => this.loaded.emit(true)))
+      .subscribe(
+        ({ data }) => this.videos = data,
+
+        err => this.notifier.error('Error in videos list component: ' + err.message)
+      )
+  }
+
+  getVideosObservable () {
     const options = {
       videoPagination: {
         currentPage: 1,
@@ -74,15 +86,14 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit
       categoryOneOf: this.categoryOneOf,
       languageOneOf: this.languageOneOf,
       filter: this.filter,
-      sort: this.sort as VideoSortField
+      sort: this.sort as VideoSortField,
+      account: { nameWithHost: this.accountHandle },
+      videoChannel: { nameWithHost: this.channelHandle }
     }
 
-    this.videoService.getVideos(options)
-      .pipe(finalize(() => this.loaded.emit(true)))
-      .subscribe(
-        ({ data }) => this.videos = data,
+    if (this.channelHandle) return this.videoService.getVideoChannelVideos(options)
+    if (this.accountHandle) return this.videoService.getAccountVideos(options)
 
-        err => this.notifier.error('Error in videos list component: ' + err.message)
-      )
+    return this.videoService.getVideos(options)
   }
 }