X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=inline;f=client%2Fsrc%2Fapp%2F%2Bmy-account%2Fmy-account-settings%2Fmy-account-video-settings%2Fmy-account-video-settings.component.ts;h=b8f80bc1a344527ae0ab56c807a54a13e01158e0;hb=f8b2c1b4f509c037b9650cca2c5befd21f056df3;hp=36556706e1e8dbb042207d0c7e801543d42ccc3e;hpb=d879e48b216d34c9f9a51b33442ce082a954ed02;p=github%2FChocobozzz%2FPeerTube.git 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 36556706e..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,11 +1,11 @@ import { Component, Input, OnInit } from '@angular/core' -import { NotificationsService } from 'angular2-notifications' +import { Notifier } from '@app/core' import { UserUpdateMe } from '../../../../../../shared' 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/Subject' +import { Subject } from 'rxjs' @Component({ selector: 'my-account-video-settings', @@ -19,7 +19,7 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI constructor ( protected formValidatorService: FormValidatorService, private authService: AuthService, - private notificationsService: NotificationsService, + private notifier: Notifier, private userService: UserService, private i18n: I18n ) { @@ -29,12 +29,14 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI ngOnInit () { this.buildForm({ nsfwPolicy: null, + webTorrentEnabled: null, autoPlayVideo: null }) this.userInformationLoaded.subscribe(() => { this.form.patchValue({ nsfwPolicy: this.user.nsfwPolicy, + webTorrentEnabled: this.user.webTorrentEnabled, autoPlayVideo: this.user.autoPlayVideo === true }) }) @@ -42,20 +44,22 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI updateDetails () { const nsfwPolicy = this.form.value['nsfwPolicy'] + const webTorrentEnabled = this.form.value['webTorrentEnabled'] const autoPlayVideo = this.form.value['autoPlayVideo'] const details: UserUpdateMe = { nsfwPolicy, + webTorrentEnabled, autoPlayVideo } this.userService.updateMyProfile(details).subscribe( () => { - this.notificationsService.success(this.i18n('Success'), this.i18n('Information updated.')) + this.notifier.success(this.i18n('Information updated.')) this.authService.refreshUserInformation() }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } }