diff options
author | Chocobozzz <me@florianbigard.com> | 2023-01-19 14:52:27 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-01-19 14:52:27 +0100 |
commit | 789ba349318e7ff012590491e76087a1204cccd4 (patch) | |
tree | 69837d320c77260a188b9ee8f59505e540ad505e /client/src/app/+about/about-instance/about-instance.resolver.ts | |
parent | a4927884b224e3d4d78ff5db88cbb77bbdf8ee0b (diff) | |
download | PeerTube-789ba349318e7ff012590491e76087a1204cccd4.tar.gz PeerTube-789ba349318e7ff012590491e76087a1204cccd4.tar.zst PeerTube-789ba349318e7ff012590491e76087a1204cccd4.zip |
Support mailto links for custom markup
Diffstat (limited to 'client/src/app/+about/about-instance/about-instance.resolver.ts')
-rw-r--r-- | client/src/app/+about/about-instance/about-instance.resolver.ts | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/client/src/app/+about/about-instance/about-instance.resolver.ts b/client/src/app/+about/about-instance/about-instance.resolver.ts index ee0219df0..8818fc582 100644 --- a/client/src/app/+about/about-instance/about-instance.resolver.ts +++ b/client/src/app/+about/about-instance/about-instance.resolver.ts | |||
@@ -2,16 +2,25 @@ import { forkJoin } from 'rxjs' | |||
2 | import { map, switchMap } from 'rxjs/operators' | 2 | import { map, switchMap } from 'rxjs/operators' |
3 | import { Injectable } from '@angular/core' | 3 | import { Injectable } from '@angular/core' |
4 | import { Resolve } from '@angular/router' | 4 | import { Resolve } from '@angular/router' |
5 | import { InstanceService } from '@app/shared/shared-instance' | 5 | import { CustomMarkupService } from '@app/shared/shared-custom-markup' |
6 | import { AboutHTML, InstanceService } from '@app/shared/shared-instance' | ||
6 | import { About } from '@shared/models/server' | 7 | import { About } from '@shared/models/server' |
7 | 8 | ||
8 | export type ResolverData = { about: About, languages: string[], categories: string[] } | 9 | export type ResolverData = { |
10 | about: About | ||
11 | languages: string[] | ||
12 | categories: string[] | ||
13 | aboutHTML: AboutHTML | ||
14 | descriptionElement: HTMLDivElement | ||
15 | } | ||
9 | 16 | ||
10 | @Injectable() | 17 | @Injectable() |
11 | export class AboutInstanceResolver implements Resolve<any> { | 18 | export class AboutInstanceResolver implements Resolve<any> { |
12 | 19 | ||
13 | constructor ( | 20 | constructor ( |
14 | private instanceService: InstanceService | 21 | private instanceService: InstanceService, |
22 | private customMarkupService: CustomMarkupService | ||
23 | |||
15 | ) {} | 24 | ) {} |
16 | 25 | ||
17 | resolve () { | 26 | resolve () { |
@@ -19,9 +28,15 @@ export class AboutInstanceResolver implements Resolve<any> { | |||
19 | .pipe( | 28 | .pipe( |
20 | switchMap(about => { | 29 | switchMap(about => { |
21 | return forkJoin([ | 30 | return forkJoin([ |
31 | Promise.resolve(about), | ||
22 | this.instanceService.buildTranslatedLanguages(about), | 32 | this.instanceService.buildTranslatedLanguages(about), |
23 | this.instanceService.buildTranslatedCategories(about) | 33 | this.instanceService.buildTranslatedCategories(about), |
24 | ]).pipe(map(([ languages, categories ]) => ({ about, languages, categories }) as ResolverData)) | 34 | this.instanceService.buildHtml(about), |
35 | this.customMarkupService.buildElement(about.instance.description) | ||
36 | ]) | ||
37 | }), | ||
38 | map(([ about, languages, categories, aboutHTML, { rootElement } ]) => { | ||
39 | return { about, languages, categories, aboutHTML, descriptionElement: rootElement } as ResolverData | ||
25 | }) | 40 | }) |
26 | ) | 41 | ) |
27 | } | 42 | } |