diff options
Diffstat (limited to 'client/src/app')
3 files changed, 23 insertions, 9 deletions
diff --git a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts index 15da94709..231e52d0a 100644 --- a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts +++ b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts | |||
@@ -188,6 +188,9 @@ export class CustomMarkupService { | |||
188 | categoryOneOf: this.buildArrayNumber(data.categoryOneOf) ?? [], | 188 | categoryOneOf: this.buildArrayNumber(data.categoryOneOf) ?? [], |
189 | languageOneOf: this.buildArrayString(data.languageOneOf) ?? [], | 189 | languageOneOf: this.buildArrayString(data.languageOneOf) ?? [], |
190 | 190 | ||
191 | accountHandle: data.accountHandle || undefined, | ||
192 | channelHandle: data.channelHandle || undefined, | ||
193 | |||
191 | filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined | 194 | filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined |
192 | } | 195 | } |
193 | 196 | ||
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 | |||
23 | @Input() onlyDisplayTitle: boolean | 23 | @Input() onlyDisplayTitle: boolean |
24 | @Input() filter: VideoFilter | 24 | @Input() filter: VideoFilter |
25 | @Input() maxRows: number | 25 | @Input() maxRows: number |
26 | @Input() channelHandle: string | ||
27 | @Input() accountHandle: string | ||
26 | 28 | ||
27 | @Output() loaded = new EventEmitter<boolean>() | 29 | @Output() loaded = new EventEmitter<boolean>() |
28 | 30 | ||
@@ -66,6 +68,16 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit | |||
66 | } | 68 | } |
67 | } | 69 | } |
68 | 70 | ||
71 | return this.getVideosObservable() | ||
72 | .pipe(finalize(() => this.loaded.emit(true))) | ||
73 | .subscribe( | ||
74 | ({ data }) => this.videos = data, | ||
75 | |||
76 | err => this.notifier.error('Error in videos list component: ' + err.message) | ||
77 | ) | ||
78 | } | ||
79 | |||
80 | getVideosObservable () { | ||
69 | const options = { | 81 | const options = { |
70 | videoPagination: { | 82 | videoPagination: { |
71 | currentPage: 1, | 83 | currentPage: 1, |
@@ -74,15 +86,14 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit | |||
74 | categoryOneOf: this.categoryOneOf, | 86 | categoryOneOf: this.categoryOneOf, |
75 | languageOneOf: this.languageOneOf, | 87 | languageOneOf: this.languageOneOf, |
76 | filter: this.filter, | 88 | filter: this.filter, |
77 | sort: this.sort as VideoSortField | 89 | sort: this.sort as VideoSortField, |
90 | account: { nameWithHost: this.accountHandle }, | ||
91 | videoChannel: { nameWithHost: this.channelHandle } | ||
78 | } | 92 | } |
79 | 93 | ||
80 | this.videoService.getVideos(options) | 94 | if (this.channelHandle) return this.videoService.getVideoChannelVideos(options) |
81 | .pipe(finalize(() => this.loaded.emit(true))) | 95 | if (this.accountHandle) return this.videoService.getAccountVideos(options) |
82 | .subscribe( | ||
83 | ({ data }) => this.videos = data, | ||
84 | 96 | ||
85 | err => this.notifier.error('Error in videos list component: ' + err.message) | 97 | return this.videoService.getVideos(options) |
86 | ) | ||
87 | } | 98 | } |
88 | } | 99 | } |
diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts index 1410edd18..ac640c791 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts | |||
@@ -145,7 +145,7 @@ export class VideoService implements VideosProvider { | |||
145 | } | 145 | } |
146 | 146 | ||
147 | getAccountVideos (parameters: { | 147 | getAccountVideos (parameters: { |
148 | account: Account, | 148 | account: Pick<Account, 'nameWithHost'>, |
149 | videoPagination: ComponentPaginationLight, | 149 | videoPagination: ComponentPaginationLight, |
150 | sort: VideoSortField | 150 | sort: VideoSortField |
151 | nsfwPolicy?: NSFWPolicyType | 151 | nsfwPolicy?: NSFWPolicyType |
@@ -180,7 +180,7 @@ export class VideoService implements VideosProvider { | |||
180 | } | 180 | } |
181 | 181 | ||
182 | getVideoChannelVideos (parameters: { | 182 | getVideoChannelVideos (parameters: { |
183 | videoChannel: VideoChannel, | 183 | videoChannel: Pick<VideoChannel, 'nameWithHost'>, |
184 | videoPagination: ComponentPaginationLight, | 184 | videoPagination: ComponentPaginationLight, |
185 | sort: VideoSortField, | 185 | sort: VideoSortField, |
186 | nsfwPolicy?: NSFWPolicyType | 186 | nsfwPolicy?: NSFWPolicyType |