aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-account/my-account-settings/my-account-video-settings
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-02-11 11:52:34 +0100
committerChocobozzz <me@florianbigard.com>2019-02-11 11:52:34 +0100
commit88108880bbdba473cfe36ecbebc1c3c4f972e102 (patch)
treeb242efb3b4f0d7e49d88f2d1f2063b5b3b0489c0 /client/src/app/+my-account/my-account-settings/my-account-video-settings
parent53a94c7cfa8368da4cd248d65df8346905938f0c (diff)
parent9b712a2017e4ab3cf12cd6bd58278905520159d0 (diff)
downloadPeerTube-88108880bbdba473cfe36ecbebc1c3c4f972e102.tar.gz
PeerTube-88108880bbdba473cfe36ecbebc1c3c4f972e102.tar.zst
PeerTube-88108880bbdba473cfe36ecbebc1c3c4f972e102.zip
Merge branch 'develop' into pr/1217
Diffstat (limited to 'client/src/app/+my-account/my-account-settings/my-account-video-settings')
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html17
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts12
2 files changed, 21 insertions, 8 deletions
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 96629940f..049119fa8 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
@@ -15,10 +15,19 @@
15 </div> 15 </div>
16 </div> 16 </div>
17 17
18 <my-peertube-checkbox 18 <div class="form-group">
19 inputName="autoPlayVideo" formControlName="autoPlayVideo" 19 <my-peertube-checkbox
20 i18n-labelText labelText="Automatically plays video" 20 inputName="webTorrentEnabled" formControlName="webTorrentEnabled"
21 ></my-peertube-checkbox> 21 i18n-labelText labelText="Use WebTorrent to exchange parts of the video with others"
22 ></my-peertube-checkbox>
23 </div>
24
25 <div class="form-group">
26 <my-peertube-checkbox
27 inputName="autoPlayVideo" formControlName="autoPlayVideo"
28 i18n-labelText labelText="Automatically plays video"
29 ></my-peertube-checkbox>
30 </div>
22 31
23 <input type="submit" i18n-value value="Save" [disabled]="!form.valid"> 32 <input type="submit" i18n-value value="Save" [disabled]="!form.valid">
24</form> 33</form>
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 @@
1import { Component, Input, OnInit } from '@angular/core' 1import { Component, Input, OnInit } from '@angular/core'
2import { NotificationsService } from 'angular2-notifications' 2import { Notifier } from '@app/core'
3import { UserUpdateMe } from '../../../../../../shared' 3import { UserUpdateMe } from '../../../../../../shared'
4import { AuthService } from '../../../core' 4import { AuthService } from '../../../core'
5import { FormReactive, User, UserService } from '../../../shared' 5import { 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}