- forkJoin([
- this.serverService.getVideoLanguages(),
- this.serverService.getConfig(),
- this.userInformationLoaded.pipe(first())
- ]).subscribe(([ languages, config ]) => {
- this.languageItems = [ { label: this.i18n('Unknown language'), value: '_unknown' } ]
- this.languageItems = this.languageItems
- .concat(languages.map(l => ({ label: l.label, value: l.id })))
-
- const videoLanguages = this.user.videoLanguages
- ? this.user.videoLanguages
- : this.languageItems.map(l => l.value)
-
- 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()
+ }
+ )