diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-04 13:31:41 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-04 15:45:44 +0200 |
commit | 2989628b7913383b39ac34c7db8666a21f8e5037 (patch) | |
tree | ac7759177c04e524e7845143fd685aefb49e810e /client/src/app/shared/shared-user-settings | |
parent | 8e08d415f9473b6b72fef698729453e726da16e7 (diff) | |
download | PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.tar.gz PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.tar.zst PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.zip |
Use HTML config when possible
Diffstat (limited to 'client/src/app/shared/shared-user-settings')
-rw-r--r-- | client/src/app/shared/shared-user-settings/user-interface-settings.component.ts | 8 | ||||
-rw-r--r-- | client/src/app/shared/shared-user-settings/user-video-settings.component.ts | 6 |
2 files changed, 6 insertions, 8 deletions
diff --git a/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts b/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts index 80b88c129..b721604e5 100644 --- a/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts +++ b/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts | |||
@@ -2,7 +2,7 @@ import { Subject, Subscription } from 'rxjs' | |||
2 | import { Component, Input, OnDestroy, OnInit } from '@angular/core' | 2 | import { Component, Input, OnDestroy, OnInit } from '@angular/core' |
3 | import { AuthService, Notifier, ServerService, UserService } from '@app/core' | 3 | import { AuthService, Notifier, ServerService, UserService } from '@app/core' |
4 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 4 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
5 | import { ServerConfig, User, UserUpdateMe } from '@shared/models' | 5 | import { HTMLServerConfig, User, UserUpdateMe } from '@shared/models' |
6 | 6 | ||
7 | @Component({ | 7 | @Component({ |
8 | selector: 'my-user-interface-settings', | 8 | selector: 'my-user-interface-settings', |
@@ -17,7 +17,7 @@ export class UserInterfaceSettingsComponent extends FormReactive implements OnIn | |||
17 | 17 | ||
18 | formValuesWatcher: Subscription | 18 | formValuesWatcher: Subscription |
19 | 19 | ||
20 | private serverConfig: ServerConfig | 20 | private serverConfig: HTMLServerConfig |
21 | 21 | ||
22 | constructor ( | 22 | constructor ( |
23 | protected formValidatorService: FormValidatorService, | 23 | protected formValidatorService: FormValidatorService, |
@@ -35,9 +35,7 @@ export class UserInterfaceSettingsComponent extends FormReactive implements OnIn | |||
35 | } | 35 | } |
36 | 36 | ||
37 | ngOnInit () { | 37 | ngOnInit () { |
38 | this.serverConfig = this.serverService.getTmpConfig() | 38 | this.serverConfig = this.serverService.getHTMLConfig() |
39 | this.serverService.getConfig() | ||
40 | .subscribe(config => this.serverConfig = config) | ||
41 | 39 | ||
42 | this.buildForm({ | 40 | this.buildForm({ |
43 | theme: null | 41 | theme: null |
diff --git a/client/src/app/shared/shared-user-settings/user-video-settings.component.ts b/client/src/app/shared/shared-user-settings/user-video-settings.component.ts index ae95030c7..8b0eaea4f 100644 --- a/client/src/app/shared/shared-user-settings/user-video-settings.component.ts +++ b/client/src/app/shared/shared-user-settings/user-video-settings.component.ts | |||
@@ -48,9 +48,8 @@ export class UserVideoSettingsComponent extends FormReactive implements OnInit, | |||
48 | 48 | ||
49 | forkJoin([ | 49 | forkJoin([ |
50 | this.serverService.getVideoLanguages(), | 50 | this.serverService.getVideoLanguages(), |
51 | this.serverService.getConfig(), | ||
52 | this.userInformationLoaded.pipe(first()) | 51 | this.userInformationLoaded.pipe(first()) |
53 | ]).subscribe(([ languages, config ]) => { | 52 | ]).subscribe(([ languages ]) => { |
54 | const group = this.allLanguagesGroup | 53 | const group = this.allLanguagesGroup |
55 | 54 | ||
56 | this.languageItems = [ { label: $localize`Unknown language`, id: '_unknown', group } ] | 55 | this.languageItems = [ { label: $localize`Unknown language`, id: '_unknown', group } ] |
@@ -61,7 +60,8 @@ export class UserVideoSettingsComponent extends FormReactive implements OnInit, | |||
61 | ? this.user.videoLanguages.map(l => ({ id: l })) | 60 | ? this.user.videoLanguages.map(l => ({ id: l })) |
62 | : [ { group } ] | 61 | : [ { group } ] |
63 | 62 | ||
64 | this.defaultNSFWPolicy = config.instance.defaultNSFWPolicy | 63 | const serverConfig = this.serverService.getHTMLConfig() |
64 | this.defaultNSFWPolicy = serverConfig.instance.defaultNSFWPolicy | ||
65 | 65 | ||
66 | this.form.patchValue({ | 66 | this.form.patchValue({ |
67 | nsfwPolicy: this.user.nsfwPolicy || this.defaultNSFWPolicy, | 67 | nsfwPolicy: this.user.nsfwPolicy || this.defaultNSFWPolicy, |