1 import { Component, OnInit, ViewChild } from '@angular/core'
2 import { Notifier, ServerService } from '@app/core'
3 import { I18n } from '@ngx-translate/i18n-polyfill'
4 import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component'
5 import { InstanceService } from '@app/shared/instance/instance.service'
6 import { MarkdownService } from '@app/shared/renderer'
9 selector: 'my-about-instance',
10 templateUrl: './about-instance.component.html',
11 styleUrls: [ './about-instance.component.scss' ]
13 export class AboutInstanceComponent implements OnInit {
14 @ViewChild('contactAdminModal', { static: true }) contactAdminModal: ContactAdminModalComponent
22 moderationInformation: '',
26 maintenanceLifetime = ''
29 languages: string[] = []
30 categories: number[] = []
33 private notifier: Notifier,
34 private serverService: ServerService,
35 private instanceService: InstanceService,
36 private markdownService: MarkdownService,
41 return this.serverService.getConfig().instance.name
44 get isContactFormEnabled () {
45 return this.serverService.getConfig().email.enabled && this.serverService.getConfig().contactForm.enabled
49 return this.serverService.getConfig().instance.isNSFW
53 this.instanceService.getAbout()
56 this.shortDescription = res.instance.shortDescription
58 this.maintenanceLifetime = res.instance.maintenanceLifetime
59 this.businessModel = res.instance.businessModel
61 for (const key of [ 'description', 'terms', 'codeOfConduct', 'moderationInformation', 'administrator' ]) {
62 this.html[key] = await this.markdownService.textMarkdownToHTML(res.instance[key])
65 this.languages = res.instance.languages
66 this.categories = res.instance.categories
69 () => this.notifier.error(this.i18n('Cannot get about information from server'))
74 return this.contactAdminModal.show()