diff options
Diffstat (limited to 'client/src/app/+about')
-rw-r--r-- | client/src/app/+about/about-instance/about-instance.component.ts | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/client/src/app/+about/about-instance/about-instance.component.ts b/client/src/app/+about/about-instance/about-instance.component.ts index 0af1dca9c..e2c448501 100644 --- a/client/src/app/+about/about-instance/about-instance.component.ts +++ b/client/src/app/+about/about-instance/about-instance.component.ts | |||
@@ -6,7 +6,6 @@ import { InstanceService } from '@app/shared/instance/instance.service' | |||
6 | import { MarkdownService } from '@app/shared/renderer' | 6 | import { MarkdownService } from '@app/shared/renderer' |
7 | import { forkJoin } from 'rxjs' | 7 | import { forkJoin } from 'rxjs' |
8 | import { first } from 'rxjs/operators' | 8 | import { first } from 'rxjs/operators' |
9 | import { peertubeTranslate } from '@shared/models' | ||
10 | 9 | ||
11 | @Component({ | 10 | @Component({ |
12 | selector: 'my-about-instance', | 11 | selector: 'my-about-instance', |
@@ -59,32 +58,16 @@ export class AboutInstanceComponent implements OnInit { | |||
59 | this.serverService.videoLanguagesLoaded.pipe(first()), | 58 | this.serverService.videoLanguagesLoaded.pipe(first()), |
60 | this.serverService.videoCategoriesLoaded.pipe(first()) | 59 | this.serverService.videoCategoriesLoaded.pipe(first()) |
61 | ]).subscribe( | 60 | ]).subscribe( |
62 | async ([ res, translations ]) => { | 61 | async ([ about, translations ]) => { |
63 | this.shortDescription = res.instance.shortDescription | 62 | this.shortDescription = about.instance.shortDescription |
64 | 63 | ||
65 | this.maintenanceLifetime = res.instance.maintenanceLifetime | 64 | this.maintenanceLifetime = about.instance.maintenanceLifetime |
66 | this.businessModel = res.instance.businessModel | 65 | this.businessModel = about.instance.businessModel |
67 | 66 | ||
68 | for (const key of [ 'description', 'terms', 'codeOfConduct', 'moderationInformation', 'administrator' ]) { | 67 | this.html = await this.instanceService.buildHtml(about) |
69 | this.html[ key ] = await this.markdownService.textMarkdownToHTML(res.instance[ key ]) | ||
70 | } | ||
71 | 68 | ||
72 | const languagesArray = this.serverService.getVideoLanguages() | 69 | this.languages = this.instanceService.buildTranslatedLanguages(about, translations) |
73 | const categoriesArray = this.serverService.getVideoCategories() | 70 | this.categories = this.instanceService.buildTranslatedCategories(about, translations) |
74 | |||
75 | this.languages = res.instance.languages | ||
76 | .map(l => { | ||
77 | const languageObj = languagesArray.find(la => la.id === l) | ||
78 | |||
79 | return peertubeTranslate(languageObj.label, translations) | ||
80 | }) | ||
81 | |||
82 | this.categories = res.instance.categories | ||
83 | .map(c => { | ||
84 | const categoryObj = categoriesArray.find(ca => ca.id === c) | ||
85 | |||
86 | return peertubeTranslate(categoryObj.label, translations) | ||
87 | }) | ||
88 | }, | 71 | }, |
89 | 72 | ||
90 | () => this.notifier.error(this.i18n('Cannot get about information from server')) | 73 | () => this.notifier.error(this.i18n('Cannot get about information from server')) |