diff options
author | Andréas Livet <andreas.livet@gmail.com> | 2017-12-19 10:45:49 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-19 10:45:49 +0100 |
commit | 7efe153b0bc23e596d5019b9fb3e3e32b6cfeccd (patch) | |
tree | 56116e7e9f8467b78ed6dfc81827288915d31c8c /client/src/app/account/account-settings | |
parent | 228077efd73485a2832bb6211c9fa923158c2112 (diff) | |
download | PeerTube-7efe153b0bc23e596d5019b9fb3e3e32b6cfeccd.tar.gz PeerTube-7efe153b0bc23e596d5019b9fb3e3e32b6cfeccd.tar.zst PeerTube-7efe153b0bc23e596d5019b9fb3e3e32b6cfeccd.zip |
Enh #106 : Add an autoPlayVideo user attribute (#159)
Warning : I was not able to run the tests on my machine. It uses a different approach to handle databse connexion and didn't find where to configure it...
- create a migration file to add a boolean column in user table
- add autoPlayVideo attribute everywhere it is needed (both on client and server side)
- add tests
- add a way to configure this attribute in account-settings
- use the attribute in video-watch component to actually autoplay or not the video
Diffstat (limited to 'client/src/app/account/account-settings')
3 files changed, 12 insertions, 3 deletions
diff --git a/client/src/app/account/account-settings/account-details/account-details.component.html b/client/src/app/account/account-settings/account-details/account-details.component.html index bc18b39b4..593b87e29 100644 --- a/client/src/app/account/account-settings/account-details/account-details.component.html +++ b/client/src/app/account/account-settings/account-details/account-details.component.html | |||
@@ -9,6 +9,12 @@ | |||
9 | <div *ngIf="formErrors['displayNSFW']" class="alert alert-danger"> | 9 | <div *ngIf="formErrors['displayNSFW']" class="alert alert-danger"> |
10 | {{ formErrors['displayNSFW'] }} | 10 | {{ formErrors['displayNSFW'] }} |
11 | </div> | 11 | </div> |
12 | <br/> | ||
13 | <input | ||
14 | type="checkbox" id="autoPlayVideo" | ||
15 | formControlName="autoPlayVideo" | ||
16 | > | ||
17 | <label for="autoPlayVideo">Automatically plays video</label> | ||
12 | 18 | ||
13 | <input type="submit" value="Save" [disabled]="!form.valid"> | 19 | <input type="submit" value="Save" [disabled]="!form.valid"> |
14 | </form> | 20 | </form> |
diff --git a/client/src/app/account/account-settings/account-details/account-details.component.ts b/client/src/app/account/account-settings/account-details/account-details.component.ts index d835c53e5..b8c19d8d6 100644 --- a/client/src/app/account/account-settings/account-details/account-details.component.ts +++ b/client/src/app/account/account-settings/account-details/account-details.component.ts | |||
@@ -31,7 +31,8 @@ export class AccountDetailsComponent extends FormReactive implements OnInit { | |||
31 | 31 | ||
32 | buildForm () { | 32 | buildForm () { |
33 | this.form = this.formBuilder.group({ | 33 | this.form = this.formBuilder.group({ |
34 | displayNSFW: [ this.user.displayNSFW ] | 34 | displayNSFW: [ this.user.displayNSFW ], |
35 | autoPlayVideo: [ this.user.autoPlayVideo ] | ||
35 | }) | 36 | }) |
36 | 37 | ||
37 | this.form.valueChanges.subscribe(data => this.onValueChanged(data)) | 38 | this.form.valueChanges.subscribe(data => this.onValueChanged(data)) |
@@ -43,8 +44,10 @@ export class AccountDetailsComponent extends FormReactive implements OnInit { | |||
43 | 44 | ||
44 | updateDetails () { | 45 | updateDetails () { |
45 | const displayNSFW = this.form.value['displayNSFW'] | 46 | const displayNSFW = this.form.value['displayNSFW'] |
47 | const autoPlayVideo = this.form.value['autoPlayVideo'] | ||
46 | const details: UserUpdateMe = { | 48 | const details: UserUpdateMe = { |
47 | displayNSFW | 49 | displayNSFW, |
50 | autoPlayVideo | ||
48 | } | 51 | } |
49 | 52 | ||
50 | this.error = null | 53 | this.error = null |
diff --git a/client/src/app/account/account-settings/account-settings.component.html b/client/src/app/account/account-settings/account-settings.component.html index c0a74cc47..f14eadd49 100644 --- a/client/src/app/account/account-settings/account-settings.component.html +++ b/client/src/app/account/account-settings/account-settings.component.html | |||
@@ -11,5 +11,5 @@ | |||
11 | <div class="account-title">Account settings</div> | 11 | <div class="account-title">Account settings</div> |
12 | <my-account-change-password></my-account-change-password> | 12 | <my-account-change-password></my-account-change-password> |
13 | 13 | ||
14 | <div class="account-title">Filtering</div> | 14 | <div class="account-title">Videos</div> |
15 | <my-account-details [user]="user"></my-account-details> | 15 | <my-account-details [user]="user"></my-account-details> |