diff options
Diffstat (limited to 'client/src/app/+my-account/my-account-settings')
4 files changed, 38 insertions, 31 deletions
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts index ec7cf935c..9d406805f 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts | |||
@@ -6,6 +6,7 @@ import { FormValidatorService } from '@app/shared/forms/form-validators/form-val | |||
6 | import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' | 6 | import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' |
7 | import { User } from '../../../../../../shared' | 7 | import { User } from '../../../../../../shared' |
8 | import { tap } from 'rxjs/operators' | 8 | import { tap } from 'rxjs/operators' |
9 | import { forkJoin } from 'rxjs' | ||
9 | 10 | ||
10 | @Component({ | 11 | @Component({ |
11 | selector: 'my-account-change-email', | 12 | selector: 'my-account-change-email', |
@@ -45,29 +46,29 @@ export class MyAccountChangeEmailComponent extends FormReactive implements OnIni | |||
45 | const password = this.form.value[ 'password' ] | 46 | const password = this.form.value[ 'password' ] |
46 | const email = this.form.value[ 'new-email' ] | 47 | const email = this.form.value[ 'new-email' ] |
47 | 48 | ||
48 | this.userService.changeEmail(password, email) | 49 | forkJoin([ |
49 | .pipe( | 50 | this.serverService.getConfig(), |
50 | tap(() => this.authService.refreshUserInformation()) | 51 | this.userService.changeEmail(password, email) |
51 | ) | 52 | ]).pipe(tap(() => this.authService.refreshUserInformation())) |
52 | .subscribe( | 53 | .subscribe( |
53 | () => { | 54 | ([ config ]) => { |
54 | this.form.reset() | 55 | this.form.reset() |
55 | 56 | ||
56 | if (this.serverService.getConfig().signup.requiresEmailVerification) { | 57 | if (config.signup.requiresEmailVerification) { |
57 | this.success = this.i18n('Please check your emails to verify your new email.') | 58 | this.success = this.i18n('Please check your emails to verify your new email.') |
58 | } else { | 59 | } else { |
59 | this.success = this.i18n('Email updated.') | 60 | this.success = this.i18n('Email updated.') |
60 | } | 61 | } |
61 | }, | 62 | }, |
62 | |||
63 | err => { | ||
64 | if (err.status === 401) { | ||
65 | this.error = this.i18n('You current password is invalid.') | ||
66 | return | ||
67 | } | ||
68 | 63 | ||
69 | this.error = err.message | 64 | err => { |
65 | if (err.status === 401) { | ||
66 | this.error = this.i18n('You current password is invalid.') | ||
67 | return | ||
70 | } | 68 | } |
71 | ) | 69 | |
70 | this.error = err.message | ||
71 | } | ||
72 | ) | ||
72 | } | 73 | } |
73 | } | 74 | } |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-interface/my-account-interface-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-interface/my-account-interface-settings.component.ts index 5ec1c9f8f..441f89f10 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-interface/my-account-interface-settings.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-interface/my-account-interface-settings.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component, Input, OnInit } from '@angular/core' | 1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { Notifier, ServerService } from '@app/core' | 2 | import { Notifier, ServerService } from '@app/core' |
3 | import { UserUpdateMe } from '../../../../../../shared' | 3 | import { ServerConfig, UserUpdateMe } from '../../../../../../shared' |
4 | import { AuthService } from '../../../core' | 4 | import { AuthService } from '../../../core' |
5 | import { FormReactive, User, UserService } from '../../../shared' | 5 | import { FormReactive, User, UserService } from '../../../shared' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | 6 | import { I18n } from '@ngx-translate/i18n-polyfill' |
@@ -16,6 +16,8 @@ export class MyAccountInterfaceSettingsComponent extends FormReactive implements | |||
16 | @Input() user: User = null | 16 | @Input() user: User = null |
17 | @Input() userInformationLoaded: Subject<any> | 17 | @Input() userInformationLoaded: Subject<any> |
18 | 18 | ||
19 | private serverConfig: ServerConfig | ||
20 | |||
19 | constructor ( | 21 | constructor ( |
20 | protected formValidatorService: FormValidatorService, | 22 | protected formValidatorService: FormValidatorService, |
21 | private authService: AuthService, | 23 | private authService: AuthService, |
@@ -28,11 +30,15 @@ export class MyAccountInterfaceSettingsComponent extends FormReactive implements | |||
28 | } | 30 | } |
29 | 31 | ||
30 | get availableThemes () { | 32 | get availableThemes () { |
31 | return this.serverService.getConfig().theme.registered | 33 | return this.serverConfig.theme.registered |
32 | .map(t => t.name) | 34 | .map(t => t.name) |
33 | } | 35 | } |
34 | 36 | ||
35 | ngOnInit () { | 37 | ngOnInit () { |
38 | this.serverConfig = this.serverService.getTmpConfig() | ||
39 | this.serverService.getConfig() | ||
40 | .subscribe(config => this.serverConfig = config) | ||
41 | |||
36 | this.buildForm({ | 42 | this.buildForm({ |
37 | theme: null | 43 | theme: null |
38 | }) | 44 | }) |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts index 76fabb19d..6ba1a1020 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts | |||
@@ -21,7 +21,7 @@ export class MyAccountNotificationPreferencesComponent implements OnInit { | |||
21 | webNotifications: { [ id in keyof UserNotificationSetting ]: boolean } = {} as any | 21 | webNotifications: { [ id in keyof UserNotificationSetting ]: boolean } = {} as any |
22 | labelNotifications: { [ id in keyof UserNotificationSetting ]: string } = {} as any | 22 | labelNotifications: { [ id in keyof UserNotificationSetting ]: string } = {} as any |
23 | rightNotifications: { [ id in keyof Partial<UserNotificationSetting> ]: UserRight } = {} as any | 23 | rightNotifications: { [ id in keyof Partial<UserNotificationSetting> ]: UserRight } = {} as any |
24 | emailEnabled: boolean | 24 | emailEnabled = false |
25 | 25 | ||
26 | private savePreferences = debounce(this.savePreferencesImpl.bind(this), 500) | 26 | private savePreferences = debounce(this.savePreferencesImpl.bind(this), 500) |
27 | 27 | ||
@@ -31,7 +31,6 @@ export class MyAccountNotificationPreferencesComponent implements OnInit { | |||
31 | private serverService: ServerService, | 31 | private serverService: ServerService, |
32 | private notifier: Notifier | 32 | private notifier: Notifier |
33 | ) { | 33 | ) { |
34 | |||
35 | this.labelNotifications = { | 34 | this.labelNotifications = { |
36 | newVideoFromSubscription: this.i18n('New video from your subscriptions'), | 35 | newVideoFromSubscription: this.i18n('New video from your subscriptions'), |
37 | newCommentOnMyVideo: this.i18n('New comment on your video'), | 36 | newCommentOnMyVideo: this.i18n('New comment on your video'), |
@@ -55,11 +54,14 @@ export class MyAccountNotificationPreferencesComponent implements OnInit { | |||
55 | newInstanceFollower: UserRight.MANAGE_SERVER_FOLLOW, | 54 | newInstanceFollower: UserRight.MANAGE_SERVER_FOLLOW, |
56 | autoInstanceFollowing: UserRight.MANAGE_CONFIGURATION | 55 | autoInstanceFollowing: UserRight.MANAGE_CONFIGURATION |
57 | } | 56 | } |
58 | |||
59 | this.emailEnabled = this.serverService.getConfig().email.enabled | ||
60 | } | 57 | } |
61 | 58 | ||
62 | ngOnInit () { | 59 | ngOnInit () { |
60 | this.serverService.getConfig() | ||
61 | .subscribe(config => { | ||
62 | this.emailEnabled = config.email.enabled | ||
63 | }) | ||
64 | |||
63 | this.userInformationLoaded.subscribe(() => this.loadNotificationSettings()) | 65 | this.userInformationLoaded.subscribe(() => this.loadNotificationSettings()) |
64 | } | 66 | } |
65 | 67 | ||
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 99eee23b8..a66159b3f 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 | |||
@@ -41,11 +41,9 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI | |||
41 | }) | 41 | }) |
42 | 42 | ||
43 | forkJoin([ | 43 | forkJoin([ |
44 | this.serverService.videoLanguagesLoaded.pipe(first()), | 44 | this.serverService.getVideoLanguages(), |
45 | this.userInformationLoaded.pipe(first()) | 45 | this.userInformationLoaded.pipe(first()) |
46 | ]).subscribe(() => { | 46 | ]).subscribe(([ languages ]) => { |
47 | const languages = this.serverService.getVideoLanguages() | ||
48 | |||
49 | this.languageItems = [ { label: this.i18n('Unknown language'), value: '_unknown' } ] | 47 | this.languageItems = [ { label: this.i18n('Unknown language'), value: '_unknown' } ] |
50 | this.languageItems = this.languageItems | 48 | this.languageItems = this.languageItems |
51 | .concat(languages.map(l => ({ label: l.label, value: l.id }))) | 49 | .concat(languages.map(l => ({ label: l.label, value: l.id }))) |