X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Bvideo-channels%2Fvideo-channel-about%2Fvideo-channel-about.component.ts;h=11f9391e124e09861357acd91ec4765d9421ed5c;hb=41d713446c2152d47943ddb0c841a9e36ca5a9db;hp=5d435708e92ad44bf224545dfbb8f6354ca8914d;hpb=170726f523ff48f89da45473fc53ca54784f43dd;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts index 5d435708e..11f9391e1 100644 --- a/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts +++ b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts @@ -1,32 +1,46 @@ -import { Component, OnInit } from '@angular/core' -import { ActivatedRoute } from '@angular/router' -import 'rxjs/add/observable/from' -import 'rxjs/add/operator/concatAll' +import { Component, OnDestroy, OnInit } from '@angular/core' import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' import { VideoChannel } from '@app/shared/video-channel/video-channel.model' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { Subscription } from 'rxjs' +import { MarkdownService } from '@app/shared/renderer' @Component({ selector: 'my-video-channel-about', templateUrl: './video-channel-about.component.html', styleUrls: [ './video-channel-about.component.scss' ] }) -export class VideoChannelAboutComponent implements OnInit { +export class VideoChannelAboutComponent implements OnInit, OnDestroy { videoChannel: VideoChannel + descriptionHTML = '' + supportHTML = '' + + private videoChannelSub: Subscription constructor ( - protected route: ActivatedRoute, - private videoChannelService: VideoChannelService + private i18n: I18n, + private videoChannelService: VideoChannelService, + private markdownService: MarkdownService ) { } ngOnInit () { // Parent get the video channel for us - this.videoChannelService.videoChannelLoaded - .subscribe(videoChannel => this.videoChannel = videoChannel) + this.videoChannelSub = this.videoChannelService.videoChannelLoaded + .subscribe(async videoChannel => { + this.videoChannel = videoChannel + + this.descriptionHTML = await this.markdownService.textMarkdownToHTML(this.videoChannel.description) + this.supportHTML = await this.markdownService.enhancedMarkdownToHTML(this.videoChannel.support) + }) + } + + ngOnDestroy () { + if (this.videoChannelSub) this.videoChannelSub.unsubscribe() } getVideoChannelDescription () { - if (this.videoChannel.description) return this.videoChannel.description + if (this.descriptionHTML) return this.descriptionHTML - return 'No description' + return this.i18n('No description') } }