]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts
Increase abuse length to 3000
[github/Chocobozzz/PeerTube.git] / client / src / app / +video-channels / video-channel-about / video-channel-about.component.ts
1 import { Component, OnDestroy, OnInit } from '@angular/core'
2 import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
3 import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
4 import { I18n } from '@ngx-translate/i18n-polyfill'
5 import { Subscription } from 'rxjs'
6 import { MarkdownService } from '@app/shared/renderer'
7
8 @Component({
9 selector: 'my-video-channel-about',
10 templateUrl: './video-channel-about.component.html',
11 styleUrls: [ './video-channel-about.component.scss' ]
12 })
13 export class VideoChannelAboutComponent implements OnInit, OnDestroy {
14 videoChannel: VideoChannel
15 descriptionHTML = ''
16 supportHTML = ''
17
18 private videoChannelSub: Subscription
19
20 constructor (
21 private i18n: I18n,
22 private videoChannelService: VideoChannelService,
23 private markdownService: MarkdownService
24 ) { }
25
26 ngOnInit () {
27 // Parent get the video channel for us
28 this.videoChannelSub = this.videoChannelService.videoChannelLoaded
29 .subscribe(videoChannel => {
30 this.videoChannel = videoChannel
31
32 this.descriptionHTML = this.markdownService.textMarkdownToHTML(this.videoChannel.description)
33 this.supportHTML = this.markdownService.enhancedMarkdownToHTML(this.videoChannel.support)
34 })
35 }
36
37 ngOnDestroy () {
38 if (this.videoChannelSub) this.videoChannelSub.unsubscribe()
39 }
40
41 getVideoChannelDescription () {
42 if (this.descriptionHTML) return this.descriptionHTML
43
44 return this.i18n('No description')
45 }
46 }