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=df7cc95a7fbf6e34e752661de34b0c9bc6dd0c17;hb=647c2b7d0448e68d8c8ade52d9568e9b33f8638d;hp=5bb045a8230ff6dfe60358ed29caafbd39167dd5;hpb=421ff4618da64f0849353383f690a014024c40da;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 5bb045a82..df7cc95a7 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 @@ -1,10 +1,10 @@ import { from } from 'rxjs' import { finalize, map, switchMap, tap } from 'rxjs/operators' -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core' import { MarkdownService, Notifier, UserService } from '@app/core' import { FindInBulkService } from '@app/shared/shared-search' -import { Video, VideoSortField } from '@shared/models/videos' -import { VideoChannel, VideoService } from '../../shared-main' +import { VideoSortField } from '@shared/models' +import { Video, VideoChannel, VideoService } from '../../shared-main' import { CustomMarkupComponent } from './shared' /* @@ -14,7 +14,8 @@ import { CustomMarkupComponent } from './shared' @Component({ selector: 'my-channel-miniature-markup', templateUrl: 'channel-miniature-markup.component.html', - styleUrls: [ 'channel-miniature-markup.component.scss' ] + styleUrls: [ 'channel-miniature-markup.component.scss' ], + changeDetection: ChangeDetectionStrategy.OnPush }) export class ChannelMiniatureMarkupComponent implements CustomMarkupComponent, OnInit { @Input() name: string @@ -33,25 +34,36 @@ export class ChannelMiniatureMarkupComponent implements CustomMarkupComponent, O private findInBulk: FindInBulkService, private videoService: VideoService, private userService: UserService, - private notifier: Notifier + private notifier: Notifier, + private cd: ChangeDetectorRef ) { } ngOnInit () { this.findInBulk.getChannel(this.name) .pipe( - tap(channel => this.channel = channel), - switchMap(() => from(this.markdown.textMarkdownToHTML(this.channel.description))), - tap(html => this.descriptionHTML = html), + tap(channel => { + this.channel = channel + }), + switchMap(() => from(this.markdown.textMarkdownToHTML({ + markdown: this.channel.description, + withEmoji: true, + withHtml: true + }))), + 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] + + this.cd.markForCheck() }, - err => this.notifier.error($localize`Error in channel miniature component: ${err.message}`) - ) + error: err => this.notifier.error($localize`Error in channel miniature component: ${err.message}`) + }) } getVideoChannelLink () {