diff options
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/app/shared/shared-instance/instance.service.ts | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/client/src/app/shared/shared-instance/instance.service.ts b/client/src/app/shared/shared-instance/instance.service.ts index 9a55cf972..58bf8ee54 100644 --- a/client/src/app/shared/shared-instance/instance.service.ts +++ b/client/src/app/shared/shared-instance/instance.service.ts | |||
@@ -6,6 +6,7 @@ import { MarkdownService, RestExtractor, ServerService } from '@app/core' | |||
6 | import { objectKeysTyped, peertubeTranslate } from '@peertube/peertube-core-utils' | 6 | import { objectKeysTyped, peertubeTranslate } from '@peertube/peertube-core-utils' |
7 | import { About } from '@peertube/peertube-models' | 7 | import { About } from '@peertube/peertube-models' |
8 | import { environment } from '../../../environments/environment' | 8 | import { environment } from '../../../environments/environment' |
9 | import { logger } from '@root-helpers/logger' | ||
9 | 10 | ||
10 | export type AboutHTML = Pick<About['instance'], | 11 | export type AboutHTML = Pick<About['instance'], |
11 | 'terms' | 'codeOfConduct' | 'moderationInformation' | 'administrator' | 'creationReason' | | 12 | 'terms' | 'codeOfConduct' | 'moderationInformation' | 'administrator' | 'creationReason' | |
@@ -69,11 +70,15 @@ export class InstanceService { | |||
69 | ]).pipe( | 70 | ]).pipe( |
70 | map(([ languagesArray, translations ]) => { | 71 | map(([ languagesArray, translations ]) => { |
71 | return about.instance.languages | 72 | return about.instance.languages |
72 | .map(l => { | 73 | .map(l => { |
73 | const languageObj = languagesArray.find(la => la.id === l) | 74 | const languageObj = languagesArray.find(la => la.id === l) |
75 | if (!languageObj) { | ||
76 | logger.error(`Cannot find language ${l} in available languages`) | ||
77 | return '' | ||
78 | } | ||
74 | 79 | ||
75 | return peertubeTranslate(languageObj.label, translations) | 80 | return peertubeTranslate(languageObj.label, translations) |
76 | }) | 81 | }) |
77 | }) | 82 | }) |
78 | ) | 83 | ) |
79 | } | 84 | } |
@@ -85,11 +90,15 @@ export class InstanceService { | |||
85 | ]).pipe( | 90 | ]).pipe( |
86 | map(([ categoriesArray, translations ]) => { | 91 | map(([ categoriesArray, translations ]) => { |
87 | return about.instance.categories | 92 | return about.instance.categories |
88 | .map(c => { | 93 | .map(c => { |
89 | const categoryObj = categoriesArray.find(ca => ca.id === c) | 94 | const categoryObj = categoriesArray.find(ca => ca.id === c) |
95 | if (!categoryObj) { | ||
96 | logger.error(`Cannot find instance category ${c} in available categories`) | ||
97 | return '' | ||
98 | } | ||
90 | 99 | ||
91 | return peertubeTranslate(categoryObj.label, translations) | 100 | return peertubeTranslate(categoryObj.label, translations) |
92 | }) | 101 | }) |
93 | }) | 102 | }) |
94 | ) | 103 | ) |
95 | } | 104 | } |