- forkJoin([
- this.serverService.getVideoLanguages(),
- this.serverService.getConfig(),
- this.userInformationLoaded.pipe(first())
- ]).subscribe(([ languages, config ]) => {
- const group = this.allLanguagesGroup
-
- this.languageItems = [ { label: this.i18n('Unknown language'), id: '_unknown', group } ]
- this.languageItems = this.languageItems
- .concat(languages.map(l => ({ label: l.label, id: l.id, group })))
-
- const videoLanguages: ItemSelectCheckboxValue[] = this.user.videoLanguages
- ? this.user.videoLanguages.map(l => ({ id: l }))
- : [ { group } ]
-
- this.defaultNSFWPolicy = config.instance.defaultNSFWPolicy
-
- this.form.patchValue({
- nsfwPolicy: this.user.nsfwPolicy || this.defaultNSFWPolicy,
- webTorrentEnabled: this.user.webTorrentEnabled,
- autoPlayVideo: this.user.autoPlayVideo === true,
- autoPlayNextVideo: this.user.autoPlayNextVideo,
- videoLanguages
- })
-
- if (this.reactiveUpdate) {
- oldForm = { ...this.form.value }
-
- this.formValuesWatcher = this.form.valueChanges.subscribe((formValue: any) => {
- const updatedKey = Object.keys(formValue).find(k => formValue[k] !== oldForm[k])
- oldForm = { ...this.form.value }
-
- this.updateDetails([ updatedKey ])
- })
- }
- })
+ this.userInformationLoaded.pipe(first())
+ .subscribe(
+ () => {
+ const serverConfig = this.serverService.getHTMLConfig()
+ this.defaultNSFWPolicy = serverConfig.instance.defaultNSFWPolicy
+
+ this.form.patchValue({
+ nsfwPolicy: this.user.nsfwPolicy || this.defaultNSFWPolicy,
+ p2pEnabled: this.user.p2pEnabled,
+ autoPlayVideo: this.user.autoPlayVideo === true,
+ autoPlayNextVideo: this.user.autoPlayNextVideo,
+ videoLanguages: this.user.videoLanguages
+ })
+
+ if (this.reactiveUpdate) this.handleReactiveUpdate()
+ }
+ )