]>
Commit | Line | Data |
---|---|---|
d3e56c0c | 1 | import { Component, OnInit, ViewChild } from '@angular/core' |
f8b2c1b4 | 2 | import { Notifier, ServerService } from '@app/core' |
b1d40cff | 3 | import { I18n } from '@ngx-translate/i18n-polyfill' |
d3e56c0c C |
4 | import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component' |
5 | import { InstanceService } from '@app/shared/instance/instance.service' | |
1506307f | 6 | import { 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 | 13 | export 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 | 46 | .subscribe( |
41d71344 | 47 | async res => { |
45c0fb35 | 48 | this.shortDescription = res.instance.shortDescription |
41d71344 C |
49 | |
50 | this.descriptionHTML = await this.markdownService.textMarkdownToHTML(res.instance.description) | |
51 | this.termsHTML = await this.markdownService.textMarkdownToHTML(res.instance.terms) | |
36f9424f C |
52 | }, |
53 | ||
f8b2c1b4 | 54 | () => this.notifier.error(this.i18n('Cannot get about information from server')) |
36f9424f C |
55 | ) |
56 | } | |
57 | ||
d3e56c0c C |
58 | openContactModal () { |
59 | return this.contactAdminModal.show() | |
60 | } | |
61 | ||
36f9424f | 62 | } |