From 674d903b0e993b3a67836f3dabba80282d9900ab Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 1 Jul 2021 17:41:03 +0200 Subject: Support accountHandle and channelHandle --- .../videos-list-markup.component.ts | 25 ++++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'client/src/app/shared/shared-custom-markup/peertube-custom-tags') diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts index afa4f4799..d9f77802b 100644 --- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts +++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts @@ -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() @@ -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) } } -- cgit v1.2.3