]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/+about/about-instance/about-instance.component.ts
Move user registration info in features table
[github/Chocobozzz/PeerTube.git] / client / src / app / +about / about-instance / about-instance.component.ts
CommitLineData
d3e56c0c 1import { Component, OnInit, ViewChild } from '@angular/core'
f8b2c1b4 2import { Notifier, ServerService } from '@app/core'
b1d40cff 3import { I18n } from '@ngx-translate/i18n-polyfill'
d3e56c0c
C
4import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component'
5import { InstanceService } from '@app/shared/instance/instance.service'
1506307f 6import { MarkdownService } from '@app/shared/renderer'
36f9424f
C
7
8@Component({
78f912ed
C
9 selector: 'my-about-instance',
10 templateUrl: './about-instance.component.html',
11 styleUrls: [ './about-instance.component.scss' ]
36f9424f 12})
78f912ed 13export class AboutInstanceComponent implements OnInit {
d3e56c0c
C
14 @ViewChild('contactAdminModal') contactAdminModal: ContactAdminModalComponent
15
45c0fb35 16 shortDescription = ''
36f9424f
C
17 descriptionHTML = ''
18 termsHTML = ''
19
20 constructor (
f8b2c1b4 21 private notifier: Notifier,
36f9424f 22 private serverService: ServerService,
d3e56c0c 23 private instanceService: InstanceService,
b1d40cff
C
24 private markdownService: MarkdownService,
25 private i18n: I18n
36f9424f
C
26 ) {}
27
28 get instanceName () {
29 return this.serverService.getConfig().instance.name
30 }
31
d3e56c0c
C
32 get isContactFormEnabled () {
33 return this.serverService.getConfig().email.enabled && this.serverService.getConfig().contactForm.enabled
34 }
35
36f9424f 36 ngOnInit () {
d3e56c0c 37 this.instanceService.getAbout()
36f9424f 38 .subscribe(
41d71344 39 async res => {
45c0fb35 40 this.shortDescription = res.instance.shortDescription
41d71344
C
41
42 this.descriptionHTML = await this.markdownService.textMarkdownToHTML(res.instance.description)
43 this.termsHTML = await this.markdownService.textMarkdownToHTML(res.instance.terms)
36f9424f
C
44 },
45
f8b2c1b4 46 () => this.notifier.error(this.i18n('Cannot get about information from server'))
36f9424f
C
47 )
48 }
49
d3e56c0c
C
50 openContactModal () {
51 return this.contactAdminModal.show()
52 }
53
36f9424f 54}