]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/+about/about-instance/about-instance.component.ts
Fix notification socket
[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'
36f9424f 3import { MarkdownService } from '@app/videos/shared'
b1d40cff 4import { I18n } from '@ngx-translate/i18n-polyfill'
d3e56c0c
C
5import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component'
6import { InstanceService } from '@app/shared/instance/instance.service'
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
1869c875
RK
32 get userVideoQuota () {
33 return this.serverService.getConfig().user.videoQuota
34 }
35
be1fc4bc
C
36 get isSignupAllowed () {
37 return this.serverService.getConfig().signup.allowed
38 }
39
d3e56c0c
C
40 get isContactFormEnabled () {
41 return this.serverService.getConfig().email.enabled && this.serverService.getConfig().contactForm.enabled
42 }
43
36f9424f 44 ngOnInit () {
d3e56c0c 45 this.instanceService.getAbout()
36f9424f
C
46 .subscribe(
47 res => {
45c0fb35 48 this.shortDescription = res.instance.shortDescription
07fa4c97
C
49 this.descriptionHTML = this.markdownService.textMarkdownToHTML(res.instance.description)
50 this.termsHTML = this.markdownService.textMarkdownToHTML(res.instance.terms)
36f9424f
C
51 },
52
f8b2c1b4 53 () => this.notifier.error(this.i18n('Cannot get about information from server'))
36f9424f
C
54 )
55 }
56
d3e56c0c
C
57 openContactModal () {
58 return this.contactAdminModal.show()
59 }
60
36f9424f 61}