diff options
Diffstat (limited to 'client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts')
-rw-r--r-- | client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts | 12 |
1 files changed, 8 insertions, 4 deletions
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 7089b2057..b8f80bc1a 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 | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, Input, OnInit } from '@angular/core' | 1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { Notifier } from '@app/core' |
3 | import { UserUpdateMe } from '../../../../../../shared' | 3 | import { 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' |
@@ -19,7 +19,7 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI | |||
19 | constructor ( | 19 | constructor ( |
20 | protected formValidatorService: FormValidatorService, | 20 | protected formValidatorService: FormValidatorService, |
21 | private authService: AuthService, | 21 | private authService: AuthService, |
22 | private notificationsService: NotificationsService, | 22 | private notifier: Notifier, |
23 | private userService: UserService, | 23 | private userService: UserService, |
24 | private i18n: I18n | 24 | private i18n: I18n |
25 | ) { | 25 | ) { |
@@ -29,12 +29,14 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI | |||
29 | ngOnInit () { | 29 | ngOnInit () { |
30 | this.buildForm({ | 30 | this.buildForm({ |
31 | nsfwPolicy: null, | 31 | nsfwPolicy: null, |
32 | webTorrentEnabled: null, | ||
32 | autoPlayVideo: null | 33 | autoPlayVideo: null |
33 | }) | 34 | }) |
34 | 35 | ||
35 | this.userInformationLoaded.subscribe(() => { | 36 | this.userInformationLoaded.subscribe(() => { |
36 | this.form.patchValue({ | 37 | this.form.patchValue({ |
37 | nsfwPolicy: this.user.nsfwPolicy, | 38 | nsfwPolicy: this.user.nsfwPolicy, |
39 | webTorrentEnabled: this.user.webTorrentEnabled, | ||
38 | autoPlayVideo: this.user.autoPlayVideo === true | 40 | autoPlayVideo: this.user.autoPlayVideo === true |
39 | }) | 41 | }) |
40 | }) | 42 | }) |
@@ -42,20 +44,22 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI | |||
42 | 44 | ||
43 | updateDetails () { | 45 | updateDetails () { |
44 | const nsfwPolicy = this.form.value['nsfwPolicy'] | 46 | const nsfwPolicy = this.form.value['nsfwPolicy'] |
47 | const webTorrentEnabled = this.form.value['webTorrentEnabled'] | ||
45 | const autoPlayVideo = this.form.value['autoPlayVideo'] | 48 | const autoPlayVideo = this.form.value['autoPlayVideo'] |
46 | const details: UserUpdateMe = { | 49 | const details: UserUpdateMe = { |
47 | nsfwPolicy, | 50 | nsfwPolicy, |
51 | webTorrentEnabled, | ||
48 | autoPlayVideo | 52 | autoPlayVideo |
49 | } | 53 | } |
50 | 54 | ||
51 | this.userService.updateMyProfile(details).subscribe( | 55 | this.userService.updateMyProfile(details).subscribe( |
52 | () => { | 56 | () => { |
53 | this.notificationsService.success(this.i18n('Success'), this.i18n('Information updated.')) | 57 | this.notifier.success(this.i18n('Information updated.')) |
54 | 58 | ||
55 | this.authService.refreshUserInformation() | 59 | this.authService.refreshUserInformation() |
56 | }, | 60 | }, |
57 | 61 | ||
58 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 62 | err => this.notifier.error(err.message) |
59 | ) | 63 | ) |
60 | } | 64 | } |
61 | } | 65 | } |