X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-custom-markup%2Fpeertube-custom-tags%2Fchannel-miniature-markup.component.ts;h=e9c466a904bd641e4682aeff5fe47efe4d865683;hb=ab4b8974997777373a6032073f9c1aaf33ba9931;hp=7043a7ec95ee1f7681453528ae542cc375d493f4;hpb=8b61dcaf23a66d508c05641c9c09747bf03cdb48;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts index 7043a7ec9..e9c466a90 100644 --- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts +++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts @@ -2,8 +2,9 @@ import { from } from 'rxjs' import { finalize, map, switchMap, tap } from 'rxjs/operators' import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' import { MarkdownService, Notifier, UserService } from '@app/core' -import { Video, VideoSortField } from '@shared/models/videos' -import { VideoChannel, VideoChannelService, VideoService } from '../../shared-main' +import { FindInBulkService } from '@app/shared/shared-search' +import { VideoSortField } from '@shared/models' +import { Video, VideoChannel, VideoService } from '../../shared-main' import { CustomMarkupComponent } from './shared' /* @@ -29,28 +30,32 @@ export class ChannelMiniatureMarkupComponent implements CustomMarkupComponent, O constructor ( private markdown: MarkdownService, - private channelService: VideoChannelService, + private findInBulk: FindInBulkService, private videoService: VideoService, private userService: UserService, private notifier: Notifier ) { } ngOnInit () { - this.channelService.getVideoChannel(this.name) + this.findInBulk.getChannel(this.name) .pipe( - tap(channel => this.channel = channel), + tap(channel => { + this.channel = channel + }), switchMap(() => from(this.markdown.textMarkdownToHTML(this.channel.description))), - tap(html => this.descriptionHTML = html), + tap(html => { + this.descriptionHTML = html + }), switchMap(() => this.loadVideosObservable()), finalize(() => this.loaded.emit(true)) - ).subscribe( - ({ total, data }) => { + ).subscribe({ + next: ({ total, data }) => { this.totalVideos = total this.video = data[0] }, - err => this.notifier.error('Error in channel miniature component: ' + err.message) - ) + error: err => this.notifier.error($localize`Error in channel miniature component: ${err.message}`) + }) } getVideoChannelLink () {