+ this.findInBulk.getChannel(this.name)
+ .pipe(
+ tap(channel => {
+ this.channel = channel
+ }),
+ switchMap(() => from(this.markdown.textMarkdownToHTML(this.channel.description))),
+ tap(html => {
+ this.descriptionHTML = html
+ }),
+ switchMap(() => this.loadVideosObservable()),
+ finalize(() => this.loaded.emit(true))
+ ).subscribe({
+ next: ({ total, data }) => {
+ this.totalVideos = total
+ this.video = data[0]
+ },
+
+ error: err => this.notifier.error($localize`Error in channel miniature component: ${err.message}`)
+ })
+ }
+
+ getVideoChannelLink () {
+ return [ '/c', this.channel.nameWithHost ]
+ }
+
+ private loadVideosObservable () {
+ const videoOptions = {
+ videoChannel: this.channel,
+ videoPagination: {
+ currentPage: 1,
+ itemsPerPage: 1
+ },
+ sort: '-publishedAt' as VideoSortField,
+ count: 1
+ }
+
+ return this.userService.getAnonymousOrLoggedUser()
+ .pipe(
+ map(user => user.nsfwPolicy),
+ switchMap(nsfwPolicy => this.videoService.getVideoChannelVideos({ ...videoOptions, nsfwPolicy }))
+ )