]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/+accounts/account-about/account-about.component.ts
Migrate to $localize
[github/Chocobozzz/PeerTube.git] / client / src / app / +accounts / account-about / account-about.component.ts
CommitLineData
67ed6552 1import { Subscription } from 'rxjs'
1506307f 2import { Component, OnDestroy, OnInit } from '@angular/core'
67ed6552
C
3import { MarkdownService } from '@app/core'
4import { Account, AccountService } from '@app/shared/shared-main'
0626e7af
C
5
6@Component({
7 selector: 'my-account-about',
8 templateUrl: './account-about.component.html',
9 styleUrls: [ './account-about.component.scss' ]
10})
734a5ceb 11export class AccountAboutComponent implements OnInit, OnDestroy {
6b738c7a 12 account: Account
53055a11 13 descriptionHTML = ''
0626e7af 14
734a5ceb
C
15 private accountSub: Subscription
16
0626e7af 17 constructor (
53055a11
C
18 private accountService: AccountService,
19 private markdownService: MarkdownService
0626e7af
C
20 ) { }
21
22 ngOnInit () {
23 // Parent get the account for us
734a5ceb 24 this.accountSub = this.accountService.accountLoaded
41d71344 25 .subscribe(async account => {
53055a11 26 this.account = account
3131c13e 27 this.descriptionHTML = await this.markdownService.textMarkdownToHTML(this.account.description, true)
53055a11 28 })
0626e7af
C
29 }
30
734a5ceb
C
31 ngOnDestroy () {
32 if (this.accountSub) this.accountSub.unsubscribe()
33 }
34
0626e7af 35 getAccountDescription () {
53055a11 36 if (this.descriptionHTML) return this.descriptionHTML
0626e7af 37
66357162 38 return $localize`No description`
0626e7af
C
39 }
40}