]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/+accounts/account-about/account-about.component.ts
Merge pull request #1105 from BO41/unused-imports
[github/Chocobozzz/PeerTube.git] / client / src / app / +accounts / account-about / account-about.component.ts
CommitLineData
734a5ceb 1import { Component, OnInit, OnDestroy } from '@angular/core'
0626e7af
C
2import { Account } from '@app/shared/account/account.model'
3import { AccountService } from '@app/shared/account/account.service'
b1d40cff 4import { I18n } from '@ngx-translate/i18n-polyfill'
734a5ceb 5import { Subscription } from 'rxjs'
53055a11 6import { MarkdownService } from '@app/videos/shared'
0626e7af
C
7
8@Component({
9 selector: 'my-account-about',
10 templateUrl: './account-about.component.html',
11 styleUrls: [ './account-about.component.scss' ]
12})
734a5ceb 13export class AccountAboutComponent implements OnInit, OnDestroy {
6b738c7a 14 account: Account
53055a11 15 descriptionHTML = ''
0626e7af 16
734a5ceb
C
17 private accountSub: Subscription
18
0626e7af 19 constructor (
b1d40cff 20 private i18n: I18n,
53055a11
C
21 private accountService: AccountService,
22 private markdownService: MarkdownService
0626e7af
C
23 ) { }
24
25 ngOnInit () {
26 // Parent get the account for us
734a5ceb 27 this.accountSub = this.accountService.accountLoaded
53055a11
C
28 .subscribe(account => {
29 this.account = account
30 this.descriptionHTML = this.markdownService.textMarkdownToHTML(this.account.description)
31 })
0626e7af
C
32 }
33
734a5ceb
C
34 ngOnDestroy () {
35 if (this.accountSub) this.accountSub.unsubscribe()
36 }
37
0626e7af 38 getAccountDescription () {
53055a11 39 if (this.descriptionHTML) return this.descriptionHTML
0626e7af 40
b1d40cff 41 return this.i18n('No description')
0626e7af
C
42 }
43}