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=ea7b0e118875f41b2945aeacfd4f37fdd98c91b2;hb=5ce1208a0a57d566b5b1fd57ec291a7d053ebaf0;hp=6f862718f22acfb0e0cefbbe17a3927a423c2b19;hpb=db400f447a9f7aae1c56fa25396e93069744483f;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 6f862718f..ea7b0e118 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,30 +1,46 @@ -import { Component, OnInit } from '@angular/core' -import { ActivatedRoute } from '@angular/router' +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/videos/shared' @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(videoChannel => { + this.videoChannel = videoChannel + + this.descriptionHTML = this.markdownService.textMarkdownToHTML(this.videoChannel.description) + this.supportHTML = 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') } }