From ccc00cb2aac1360921b957f3ecb3be7eb55dfa1b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 23 Aug 2019 15:23:27 +0200 Subject: Add more attributes to about page --- .../my-account-video-settings.component.html | 2 +- .../my-account-video-settings.component.ts | 47 +++++++++++----------- client/src/app/+my-account/my-account.module.ts | 4 +- 3 files changed, 26 insertions(+), 27 deletions(-) (limited to 'client/src/app/+my-account') diff --git a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html index 2796dd2db..caa032149 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html +++ b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html @@ -23,7 +23,7 @@
diff --git a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts index 77febf179..4fb828082 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts @@ -5,9 +5,9 @@ import { AuthService } from '../../../core' import { FormReactive, User, UserService } from '../../../shared' import { I18n } from '@ngx-translate/i18n-polyfill' import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' -import { Subject } from 'rxjs' +import { forkJoin, Subject } from 'rxjs' import { SelectItem } from 'primeng/api' -import { switchMap } from 'rxjs/operators' +import { first } from 'rxjs/operators' @Component({ selector: 'my-account-video-settings', @@ -39,30 +39,31 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI videoLanguages: null }) - this.serverService.videoLanguagesLoaded - .pipe(switchMap(() => this.userInformationLoaded)) - .subscribe(() => { - const languages = this.serverService.getVideoLanguages() - - 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.form.patchValue({ - nsfwPolicy: this.user.nsfwPolicy, - webTorrentEnabled: this.user.webTorrentEnabled, - autoPlayVideo: this.user.autoPlayVideo === true, - videoLanguages - }) - }) + forkJoin([ + this.serverService.videoLanguagesLoaded.pipe(first()), + this.userInformationLoaded.pipe(first()) + ]).subscribe(() => { + const languages = this.serverService.getVideoLanguages() + + 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.form.patchValue({ + nsfwPolicy: this.user.nsfwPolicy, + webTorrentEnabled: this.user.webTorrentEnabled, + autoPlayVideo: this.user.autoPlayVideo === true, + videoLanguages + }) + }) } updateDetails () { - const nsfwPolicy = this.form.value['nsfwPolicy'] + const nsfwPolicy = this.form.value[ 'nsfwPolicy' ] const webTorrentEnabled = this.form.value['webTorrentEnabled'] const autoPlayVideo = this.form.value['autoPlayVideo'] diff --git a/client/src/app/+my-account/my-account.module.ts b/client/src/app/+my-account/my-account.module.ts index 571f46de9..6cf1499d3 100644 --- a/client/src/app/+my-account/my-account.module.ts +++ b/client/src/app/+my-account/my-account.module.ts @@ -37,7 +37,6 @@ import { } from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component' import { DragDropModule } from '@angular/cdk/drag-drop' import { MyAccountChangeEmailComponent } from '@app/+my-account/my-account-settings/my-account-change-email' -import { MultiSelectModule } from 'primeng/multiselect' import { MyAccountInterfaceSettingsComponent } from '@app/+my-account/my-account-settings/my-account-interface' @NgModule({ @@ -48,8 +47,7 @@ import { MyAccountInterfaceSettingsComponent } from '@app/+my-account/my-account SharedModule, TableModule, InputSwitchModule, - DragDropModule, - MultiSelectModule + DragDropModule ], declarations: [ -- cgit v1.2.3