diff options
Diffstat (limited to 'client/src/app/+my-account')
17 files changed, 198 insertions, 42 deletions
diff --git a/client/src/app/+my-account/my-account-history/my-account-history.component.ts b/client/src/app/+my-account/my-account-history/my-account-history.component.ts index 73340d21a..13607119e 100644 --- a/client/src/app/+my-account/my-account-history/my-account-history.component.ts +++ b/client/src/app/+my-account/my-account-history/my-account-history.component.ts | |||
@@ -27,6 +27,7 @@ export class MyAccountHistoryComponent extends AbstractVideoList implements OnIn | |||
27 | videosHistoryEnabled: boolean | 27 | videosHistoryEnabled: boolean |
28 | 28 | ||
29 | constructor ( | 29 | constructor ( |
30 | protected i18n: I18n, | ||
30 | protected router: Router, | 31 | protected router: Router, |
31 | protected serverService: ServerService, | 32 | protected serverService: ServerService, |
32 | protected route: ActivatedRoute, | 33 | protected route: ActivatedRoute, |
@@ -34,7 +35,6 @@ export class MyAccountHistoryComponent extends AbstractVideoList implements OnIn | |||
34 | protected userService: UserService, | 35 | protected userService: UserService, |
35 | protected notifier: Notifier, | 36 | protected notifier: Notifier, |
36 | protected screenService: ScreenService, | 37 | protected screenService: ScreenService, |
37 | protected i18n: I18n, | ||
38 | private confirmService: ConfirmService, | 38 | private confirmService: ConfirmService, |
39 | private videoService: VideoService, | 39 | private videoService: VideoService, |
40 | private userHistoryService: UserHistoryService | 40 | private userHistoryService: UserHistoryService |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-email/index.ts b/client/src/app/+my-account/my-account-settings/my-account-change-email/index.ts new file mode 100644 index 000000000..f42af361e --- /dev/null +++ b/client/src/app/+my-account/my-account-settings/my-account-change-email/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './my-account-change-email.component' | |||
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.html b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.html new file mode 100644 index 000000000..5492cdf22 --- /dev/null +++ b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.html | |||
@@ -0,0 +1,36 @@ | |||
1 | <div *ngIf="error" class="alert alert-danger">{{ error }}</div> | ||
2 | <div *ngIf="success" class="alert alert-success">{{ success }}</div> | ||
3 | |||
4 | <div i18n class="current-email"> | ||
5 | Your current email is <span class="email">{{ user.email }}</span> | ||
6 | </div> | ||
7 | |||
8 | <div i18n class="pending-email" *ngIf="user.pendingEmail"> | ||
9 | <span class="email">{{ user.pendingEmail }}</span> is awaiting email verification | ||
10 | </div> | ||
11 | |||
12 | <form role="form" class="change-email" (ngSubmit)="changeEmail()" [formGroup]="form"> | ||
13 | |||
14 | <div class="form-group"> | ||
15 | <label i18n for="new-email">New email</label> | ||
16 | <input | ||
17 | type="email" id="new-email" i18n-placeholder placeholder="Your new email" | ||
18 | formControlName="new-email" [ngClass]="{ 'input-error': formErrors['new-email'] }" | ||
19 | > | ||
20 | <div *ngIf="formErrors['new-email']" class="form-error"> | ||
21 | {{ formErrors['new-email'] }} | ||
22 | </div> | ||
23 | </div> | ||
24 | |||
25 | <div class="form-group"> | ||
26 | <input | ||
27 | type="password" id="password" i18n-placeholder placeholder="Your password" | ||
28 | formControlName="password" [ngClass]="{ 'input-error': formErrors['password'] }" | ||
29 | > | ||
30 | <div *ngIf="formErrors['password']" class="form-error"> | ||
31 | {{ formErrors['password'] }} | ||
32 | </div> | ||
33 | </div> | ||
34 | |||
35 | <input type="submit" i18n-value value="Change email" [disabled]="!form.valid"> | ||
36 | </form> | ||
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.scss b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.scss new file mode 100644 index 000000000..81eba3ec9 --- /dev/null +++ b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.scss | |||
@@ -0,0 +1,24 @@ | |||
1 | @import '_variables'; | ||
2 | @import '_mixins'; | ||
3 | |||
4 | input[type=password], | ||
5 | input[type=email] { | ||
6 | @include peertube-input-text(340px); | ||
7 | |||
8 | display: block; | ||
9 | } | ||
10 | |||
11 | input[type=submit] { | ||
12 | @include peertube-button; | ||
13 | @include orange-button; | ||
14 | } | ||
15 | |||
16 | .current-email, | ||
17 | .pending-email { | ||
18 | font-size: 16px; | ||
19 | margin: 15px 0; | ||
20 | |||
21 | .email { | ||
22 | font-weight: $font-semibold; | ||
23 | } | ||
24 | } | ||
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 new file mode 100644 index 000000000..ec7cf935c --- /dev/null +++ b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts | |||
@@ -0,0 +1,73 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | ||
2 | import { AuthService, Notifier, ServerService } from '@app/core' | ||
3 | import { FormReactive, UserService } from '../../../shared' | ||
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
5 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | ||
6 | import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' | ||
7 | import { User } from '../../../../../../shared' | ||
8 | import { tap } from 'rxjs/operators' | ||
9 | |||
10 | @Component({ | ||
11 | selector: 'my-account-change-email', | ||
12 | templateUrl: './my-account-change-email.component.html', | ||
13 | styleUrls: [ './my-account-change-email.component.scss' ] | ||
14 | }) | ||
15 | export class MyAccountChangeEmailComponent extends FormReactive implements OnInit { | ||
16 | error: string = null | ||
17 | success: string = null | ||
18 | user: User = null | ||
19 | |||
20 | constructor ( | ||
21 | protected formValidatorService: FormValidatorService, | ||
22 | private userValidatorsService: UserValidatorsService, | ||
23 | private notifier: Notifier, | ||
24 | private authService: AuthService, | ||
25 | private userService: UserService, | ||
26 | private serverService: ServerService, | ||
27 | private i18n: I18n | ||
28 | ) { | ||
29 | super() | ||
30 | } | ||
31 | |||
32 | ngOnInit () { | ||
33 | this.buildForm({ | ||
34 | 'new-email': this.userValidatorsService.USER_EMAIL, | ||
35 | 'password': this.userValidatorsService.USER_PASSWORD | ||
36 | }) | ||
37 | |||
38 | this.user = this.authService.getUser() | ||
39 | } | ||
40 | |||
41 | changeEmail () { | ||
42 | this.error = null | ||
43 | this.success = null | ||
44 | |||
45 | const password = this.form.value[ 'password' ] | ||
46 | const email = this.form.value[ 'new-email' ] | ||
47 | |||
48 | this.userService.changeEmail(password, email) | ||
49 | .pipe( | ||
50 | tap(() => this.authService.refreshUserInformation()) | ||
51 | ) | ||
52 | .subscribe( | ||
53 | () => { | ||
54 | this.form.reset() | ||
55 | |||
56 | if (this.serverService.getConfig().signup.requiresEmailVerification) { | ||
57 | this.success = this.i18n('Please check your emails to verify your new email.') | ||
58 | } else { | ||
59 | this.success = this.i18n('Email updated.') | ||
60 | } | ||
61 | }, | ||
62 | |||
63 | err => { | ||
64 | if (err.status === 401) { | ||
65 | this.error = this.i18n('You current password is invalid.') | ||
66 | return | ||
67 | } | ||
68 | |||
69 | this.error = err.message | ||
70 | } | ||
71 | ) | ||
72 | } | ||
73 | } | ||
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html index ae797d1bc..a39061ee3 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html +++ b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | <form role="form" (ngSubmit)="changePassword()" [formGroup]="form"> | 3 | <form role="form" (ngSubmit)="changePassword()" [formGroup]="form"> |
4 | 4 | ||
5 | <label i18n for="new-password">Change password</label> | 5 | <label i18n for="current-password">Change password</label> |
6 | <input | 6 | <input |
7 | type="password" id="current-password" i18n-placeholder placeholder="Current password" | 7 | type="password" id="current-password" i18n-placeholder placeholder="Current password" |
8 | formControlName="current-password" [ngClass]="{ 'input-error': formErrors['current-password'] }" | 8 | formControlName="current-password" [ngClass]="{ 'input-error': formErrors['current-password'] }" |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts index a9503ed1b..fcad5a6c2 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts | |||
@@ -30,7 +30,7 @@ export class MyAccountProfileComponent extends FormReactive implements OnInit { | |||
30 | 30 | ||
31 | ngOnInit () { | 31 | ngOnInit () { |
32 | this.buildForm({ | 32 | this.buildForm({ |
33 | 'display-name': this.userValidatorsService.USER_DISPLAY_NAME, | 33 | 'display-name': this.userValidatorsService.USER_DISPLAY_NAME_REQUIRED, |
34 | description: this.userValidatorsService.USER_DESCRIPTION | 34 | description: this.userValidatorsService.USER_DESCRIPTION |
35 | }) | 35 | }) |
36 | 36 | ||
diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.html b/client/src/app/+my-account/my-account-settings/my-account-settings.component.html index ad64f28fe..f93d41110 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.html +++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.html | |||
@@ -13,6 +13,9 @@ | |||
13 | <div i18n class="account-title">Password</div> | 13 | <div i18n class="account-title">Password</div> |
14 | <my-account-change-password></my-account-change-password> | 14 | <my-account-change-password></my-account-change-password> |
15 | 15 | ||
16 | <div i18n class="account-title">Email</div> | ||
17 | <my-account-change-email></my-account-change-email> | ||
18 | |||
16 | <div i18n class="account-title">Video settings</div> | 19 | <div i18n class="account-title">Video settings</div> |
17 | <my-account-video-settings [user]="user" [userInformationLoaded]="userInformationLoaded"></my-account-video-settings> | 20 | <my-account-video-settings [user]="user" [userInformationLoaded]="userInformationLoaded"></my-account-video-settings> |
18 | 21 | ||
diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.component.html b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.component.html index 81fb11f45..f87df87df 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.component.html +++ b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.component.html | |||
@@ -61,5 +61,12 @@ When you will upload a video in this channel, the video support field will be au | |||
61 | </div> | 61 | </div> |
62 | </div> | 62 | </div> |
63 | 63 | ||
64 | <div class="form-group" *ngIf="isBulkUpdateVideosDisplayed()"> | ||
65 | <my-peertube-checkbox | ||
66 | inputName="bulkVideosSupportUpdate" formControlName="bulkVideosSupportUpdate" | ||
67 | i18n-labelText labelText="Overwrite support field of all videos of this channel" | ||
68 | ></my-peertube-checkbox> | ||
69 | </div> | ||
70 | |||
64 | <input type="submit" value="{{ getFormButtonTitle() }}" [disabled]="!form.valid"> | 71 | <input type="submit" value="{{ getFormButtonTitle() }}" [disabled]="!form.valid"> |
65 | </form> | 72 | </form> |
diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.ts b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.ts index 4dc65dd99..7479442d1 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.ts +++ b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-edit.ts | |||
@@ -11,4 +11,9 @@ export abstract class MyAccountVideoChannelEdit extends FormReactive { | |||
11 | 11 | ||
12 | // FIXME: We need this method so angular does not complain in the child template | 12 | // FIXME: We need this method so angular does not complain in the child template |
13 | onAvatarChange (formData: FormData) { /* empty */ } | 13 | onAvatarChange (formData: FormData) { /* empty */ } |
14 | |||
15 | // Should be implemented by the child | ||
16 | isBulkUpdateVideosDisplayed () { | ||
17 | return false | ||
18 | } | ||
14 | } | 19 | } |
diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts index da4fb645a..081e956d2 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts +++ b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts | |||
@@ -20,6 +20,7 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE | |||
20 | videoChannelToUpdate: VideoChannel | 20 | videoChannelToUpdate: VideoChannel |
21 | 21 | ||
22 | private paramsSub: Subscription | 22 | private paramsSub: Subscription |
23 | private oldSupportField: string | ||
23 | 24 | ||
24 | constructor ( | 25 | constructor ( |
25 | protected formValidatorService: FormValidatorService, | 26 | protected formValidatorService: FormValidatorService, |
@@ -39,7 +40,8 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE | |||
39 | this.buildForm({ | 40 | this.buildForm({ |
40 | 'display-name': this.videoChannelValidatorsService.VIDEO_CHANNEL_DISPLAY_NAME, | 41 | 'display-name': this.videoChannelValidatorsService.VIDEO_CHANNEL_DISPLAY_NAME, |
41 | description: this.videoChannelValidatorsService.VIDEO_CHANNEL_DESCRIPTION, | 42 | description: this.videoChannelValidatorsService.VIDEO_CHANNEL_DESCRIPTION, |
42 | support: this.videoChannelValidatorsService.VIDEO_CHANNEL_SUPPORT | 43 | support: this.videoChannelValidatorsService.VIDEO_CHANNEL_SUPPORT, |
44 | bulkVideosSupportUpdate: null | ||
43 | }) | 45 | }) |
44 | 46 | ||
45 | this.paramsSub = this.route.params.subscribe(routeParams => { | 47 | this.paramsSub = this.route.params.subscribe(routeParams => { |
@@ -49,6 +51,8 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE | |||
49 | videoChannelToUpdate => { | 51 | videoChannelToUpdate => { |
50 | this.videoChannelToUpdate = videoChannelToUpdate | 52 | this.videoChannelToUpdate = videoChannelToUpdate |
51 | 53 | ||
54 | this.oldSupportField = videoChannelToUpdate.support | ||
55 | |||
52 | this.form.patchValue({ | 56 | this.form.patchValue({ |
53 | 'display-name': videoChannelToUpdate.displayName, | 57 | 'display-name': videoChannelToUpdate.displayName, |
54 | description: videoChannelToUpdate.description, | 58 | description: videoChannelToUpdate.description, |
@@ -72,7 +76,8 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE | |||
72 | const videoChannelUpdate: VideoChannelUpdate = { | 76 | const videoChannelUpdate: VideoChannelUpdate = { |
73 | displayName: body['display-name'], | 77 | displayName: body['display-name'], |
74 | description: body.description || null, | 78 | description: body.description || null, |
75 | support: body.support || null | 79 | support: body.support || null, |
80 | bulkVideosSupportUpdate: body.bulkVideosSupportUpdate || false | ||
76 | } | 81 | } |
77 | 82 | ||
78 | this.videoChannelService.updateVideoChannel(this.videoChannelToUpdate.name, videoChannelUpdate).subscribe( | 83 | this.videoChannelService.updateVideoChannel(this.videoChannelToUpdate.name, videoChannelUpdate).subscribe( |
@@ -118,4 +123,10 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE | |||
118 | getFormButtonTitle () { | 123 | getFormButtonTitle () { |
119 | return this.i18n('Update') | 124 | return this.i18n('Update') |
120 | } | 125 | } |
126 | |||
127 | isBulkUpdateVideosDisplayed () { | ||
128 | if (this.oldSupportField === undefined) return false | ||
129 | |||
130 | return this.oldSupportField !== this.form.value['support'] | ||
131 | } | ||
121 | } | 132 | } |
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts index 87a10961f..8aed8b513 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts | |||
@@ -7,7 +7,6 @@ import { FormValidatorService } from '@app/shared/forms/form-validators/form-val | |||
7 | import { VideoPlaylistValidatorsService } from '@app/shared' | 7 | import { VideoPlaylistValidatorsService } from '@app/shared' |
8 | import { VideoPlaylistCreate } from '@shared/models/videos/playlist/video-playlist-create.model' | 8 | import { VideoPlaylistCreate } from '@shared/models/videos/playlist/video-playlist-create.model' |
9 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' | 9 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' |
10 | import { VideoConstant } from '@shared/models' | ||
11 | import { VideoPlaylistPrivacy } from '@shared/models/videos/playlist/video-playlist-privacy.model' | 10 | import { VideoPlaylistPrivacy } from '@shared/models/videos/playlist/video-playlist-privacy.model' |
12 | import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' | 11 | import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' |
13 | 12 | ||
@@ -18,7 +17,6 @@ import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' | |||
18 | }) | 17 | }) |
19 | export class MyAccountVideoPlaylistCreateComponent extends MyAccountVideoPlaylistEdit implements OnInit { | 18 | export class MyAccountVideoPlaylistCreateComponent extends MyAccountVideoPlaylistEdit implements OnInit { |
20 | error: string | 19 | error: string |
21 | videoPlaylistPrivacies: VideoConstant<VideoPlaylistPrivacy>[] = [] | ||
22 | 20 | ||
23 | constructor ( | 21 | constructor ( |
24 | protected formValidatorService: FormValidatorService, | 22 | protected formValidatorService: FormValidatorService, |
@@ -47,6 +45,7 @@ export class MyAccountVideoPlaylistCreateComponent extends MyAccountVideoPlaylis | |||
47 | }) | 45 | }) |
48 | 46 | ||
49 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) | 47 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) |
48 | .catch(err => console.error('Cannot populate user video channels.', err)) | ||
50 | 49 | ||
51 | this.serverService.videoPlaylistPrivaciesLoaded.subscribe( | 50 | this.serverService.videoPlaylistPrivaciesLoaded.subscribe( |
52 | () => { | 51 | () => { |
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.component.html b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.component.html index 303fc46f7..82321459f 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.component.html +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.component.html | |||
@@ -57,10 +57,12 @@ | |||
57 | </div> | 57 | </div> |
58 | 58 | ||
59 | <div class="form-group"> | 59 | <div class="form-group"> |
60 | <my-image-upload | 60 | <label i18n>Playlist thumbnail</label> |
61 | i18n-inputLabel inputLabel="Upload thumbnail" inputName="thumbnailfile" formControlName="thumbnailfile" | 61 | |
62 | previewWidth="200px" previewHeight="110px" | 62 | <my-preview-upload |
63 | ></my-image-upload> | 63 | i18n-inputLabel inputLabel="Edit" inputName="thumbnailfile" formControlName="thumbnailfile" |
64 | previewWidth="223px" previewHeight="122px" | ||
65 | ></my-preview-upload> | ||
64 | </div> | 66 | </div> |
65 | </div> | 67 | </div> |
66 | </div> | 68 | </div> |
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.ts index fbfb4c8f7..e94188786 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.ts | |||
@@ -1,12 +1,12 @@ | |||
1 | import { FormReactive } from '@app/shared' | 1 | import { FormReactive } from '@app/shared' |
2 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | ||
3 | import { ServerService } from '@app/core' | ||
4 | import { VideoPlaylist } from '@shared/models/videos/playlist/video-playlist.model' | 2 | import { VideoPlaylist } from '@shared/models/videos/playlist/video-playlist.model' |
3 | import { VideoConstant, VideoPlaylistPrivacy } from '@shared/models' | ||
5 | 4 | ||
6 | export abstract class MyAccountVideoPlaylistEdit extends FormReactive { | 5 | export abstract class MyAccountVideoPlaylistEdit extends FormReactive { |
7 | // Declare it here to avoid errors in create template | 6 | // Declare it here to avoid errors in create template |
8 | videoPlaylistToUpdate: VideoPlaylist | 7 | videoPlaylistToUpdate: VideoPlaylist |
9 | userVideoChannels: { id: number, label: string }[] = [] | 8 | userVideoChannels: { id: number, label: string }[] = [] |
9 | videoPlaylistPrivacies: VideoConstant<VideoPlaylistPrivacy>[] = [] | ||
10 | 10 | ||
11 | abstract isCreation (): boolean | 11 | abstract isCreation (): boolean |
12 | abstract getFormButtonTitle (): string | 12 | abstract getFormButtonTitle (): string |
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts index 4887fdfb4..917ad7258 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts | |||
@@ -9,9 +9,8 @@ import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' | |||
9 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' | 9 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' |
10 | import { VideoPlaylistValidatorsService } from '@app/shared' | 10 | import { VideoPlaylistValidatorsService } from '@app/shared' |
11 | import { VideoPlaylistUpdate } from '@shared/models/videos/playlist/video-playlist-update.model' | 11 | import { VideoPlaylistUpdate } from '@shared/models/videos/playlist/video-playlist-update.model' |
12 | import { VideoConstant } from '@shared/models' | ||
13 | import { VideoPlaylistPrivacy } from '@shared/models/videos/playlist/video-playlist-privacy.model' | ||
14 | import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' | 12 | import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' |
13 | import { delayWhen, map, switchMap } from 'rxjs/operators' | ||
15 | 14 | ||
16 | @Component({ | 15 | @Component({ |
17 | selector: 'my-account-video-playlist-update', | 16 | selector: 'my-account-video-playlist-update', |
@@ -21,7 +20,6 @@ import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' | |||
21 | export class MyAccountVideoPlaylistUpdateComponent extends MyAccountVideoPlaylistEdit implements OnInit, OnDestroy { | 20 | export class MyAccountVideoPlaylistUpdateComponent extends MyAccountVideoPlaylistEdit implements OnInit, OnDestroy { |
22 | error: string | 21 | error: string |
23 | videoPlaylistToUpdate: VideoPlaylist | 22 | videoPlaylistToUpdate: VideoPlaylist |
24 | videoPlaylistPrivacies: VideoConstant<VideoPlaylistPrivacy>[] = [] | ||
25 | 23 | ||
26 | private paramsSub: Subscription | 24 | private paramsSub: Subscription |
27 | 25 | ||
@@ -53,31 +51,24 @@ export class MyAccountVideoPlaylistUpdateComponent extends MyAccountVideoPlaylis | |||
53 | }) | 51 | }) |
54 | 52 | ||
55 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) | 53 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) |
56 | 54 | .catch(err => console.error('Cannot populate user video channels.', err)) | |
57 | this.paramsSub = this.route.params.subscribe(routeParams => { | 55 | |
58 | const videoPlaylistId = routeParams['videoPlaylistId'] | 56 | this.paramsSub = this.route.params |
59 | 57 | .pipe( | |
60 | this.videoPlaylistService.getVideoPlaylist(videoPlaylistId).subscribe( | 58 | map(routeParams => routeParams['videoPlaylistId']), |
61 | videoPlaylistToUpdate => { | 59 | switchMap(videoPlaylistId => this.videoPlaylistService.getVideoPlaylist(videoPlaylistId)), |
62 | this.videoPlaylistToUpdate = videoPlaylistToUpdate | 60 | delayWhen(() => this.serverService.videoPlaylistPrivaciesLoaded) |
63 | 61 | ) | |
64 | this.hydrateFormFromPlaylist() | 62 | .subscribe( |
65 | 63 | videoPlaylistToUpdate => { | |
66 | this.serverService.videoPlaylistPrivaciesLoaded.subscribe( | 64 | this.videoPlaylistPrivacies = this.serverService.getVideoPlaylistPrivacies() |
67 | () => { | 65 | this.videoPlaylistToUpdate = videoPlaylistToUpdate |
68 | this.videoPlaylistPrivacies = this.serverService.getVideoPlaylistPrivacies() | 66 | |
69 | .filter(p => { | 67 | this.hydrateFormFromPlaylist() |
70 | // If the playlist is not private, we cannot put it in private anymore | 68 | }, |
71 | return this.videoPlaylistToUpdate.privacy.id === VideoPlaylistPrivacy.PRIVATE || | 69 | |
72 | p.id !== VideoPlaylistPrivacy.PRIVATE | 70 | err => this.error = err.message |
73 | }) | 71 | ) |
74 | } | ||
75 | ) | ||
76 | }, | ||
77 | |||
78 | err => this.error = err.message | ||
79 | ) | ||
80 | }) | ||
81 | } | 72 | } |
82 | 73 | ||
83 | ngOnDestroy () { | 74 | ngOnDestroy () { |
diff --git a/client/src/app/+my-account/my-account-videos/my-account-videos.component.html b/client/src/app/+my-account/my-account-videos/my-account-videos.component.html index 84d464800..2854093c4 100644 --- a/client/src/app/+my-account/my-account-videos/my-account-videos.component.html +++ b/client/src/app/+my-account/my-account-videos/my-account-videos.component.html | |||
@@ -20,7 +20,7 @@ | |||
20 | <my-edit-button [routerLink]="[ '/videos', 'update', video.uuid ]"></my-edit-button> | 20 | <my-edit-button [routerLink]="[ '/videos', 'update', video.uuid ]"></my-edit-button> |
21 | 21 | ||
22 | <my-button i18n-label label="Change ownership" | 22 | <my-button i18n-label label="Change ownership" |
23 | className="action-button-change-ownership" | 23 | className="action-button-change-ownership grey-button" |
24 | icon="im-with-her" | 24 | icon="im-with-her" |
25 | (click)="changeOwnership($event, video)" | 25 | (click)="changeOwnership($event, video)" |
26 | ></my-button> | 26 | ></my-button> |
diff --git a/client/src/app/+my-account/my-account.module.ts b/client/src/app/+my-account/my-account.module.ts index 4a18a9968..ca5b1f7cb 100644 --- a/client/src/app/+my-account/my-account.module.ts +++ b/client/src/app/+my-account/my-account.module.ts | |||
@@ -36,6 +36,7 @@ import { | |||
36 | MyAccountVideoPlaylistElementsComponent | 36 | MyAccountVideoPlaylistElementsComponent |
37 | } from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component' | 37 | } from '@app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component' |
38 | import { DragDropModule } from '@angular/cdk/drag-drop' | 38 | import { DragDropModule } from '@angular/cdk/drag-drop' |
39 | import { MyAccountChangeEmailComponent } from '@app/+my-account/my-account-settings/my-account-change-email' | ||
39 | 40 | ||
40 | @NgModule({ | 41 | @NgModule({ |
41 | imports: [ | 42 | imports: [ |
@@ -54,7 +55,10 @@ import { DragDropModule } from '@angular/cdk/drag-drop' | |||
54 | MyAccountChangePasswordComponent, | 55 | MyAccountChangePasswordComponent, |
55 | MyAccountVideoSettingsComponent, | 56 | MyAccountVideoSettingsComponent, |
56 | MyAccountProfileComponent, | 57 | MyAccountProfileComponent, |
58 | MyAccountChangeEmailComponent, | ||
59 | |||
57 | MyAccountVideosComponent, | 60 | MyAccountVideosComponent, |
61 | |||
58 | VideoChangeOwnershipComponent, | 62 | VideoChangeOwnershipComponent, |
59 | MyAccountOwnershipComponent, | 63 | MyAccountOwnershipComponent, |
60 | MyAccountAcceptOwnershipComponent, | 64 | MyAccountAcceptOwnershipComponent, |