diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-17 11:47:04 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-08-17 15:12:55 +0200 |
commit | 7ed1edbbe4ffbef28093e4f5630751cb652814e4 (patch) | |
tree | 831862165dbfce593447a517c2294a7a4c28d840 /client/src/app/+my-account | |
parent | 1a95f0b9627f8016767a5a386620cbc3335d5f93 (diff) | |
download | PeerTube-7ed1edbbe4ffbef28093e4f5630751cb652814e4.tar.gz PeerTube-7ed1edbbe4ffbef28093e4f5630751cb652814e4.tar.zst PeerTube-7ed1edbbe4ffbef28093e4f5630751cb652814e4.zip |
We don't need services anymore for validators
Diffstat (limited to 'client/src/app/+my-account')
9 files changed, 67 insertions, 46 deletions
diff --git a/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-create.component.ts b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-create.component.ts index 5c438c3bf..e2ea87fb8 100644 --- a/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-create.component.ts +++ b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-create.component.ts | |||
@@ -1,7 +1,13 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
3 | import { AuthService, Notifier } from '@app/core' | 3 | import { AuthService, Notifier } from '@app/core' |
4 | import { FormValidatorService, VideoChannelValidatorsService } from '@app/shared/shared-forms' | 4 | import { |
5 | VIDEO_CHANNEL_DESCRIPTION_VALIDATOR, | ||
6 | VIDEO_CHANNEL_DISPLAY_NAME_VALIDATOR, | ||
7 | VIDEO_CHANNEL_NAME_VALIDATOR, | ||
8 | VIDEO_CHANNEL_SUPPORT_VALIDATOR | ||
9 | } from '@app/shared/form-validators/video-channel-validators' | ||
10 | import { FormValidatorService } from '@app/shared/shared-forms' | ||
5 | import { VideoChannelService } from '@app/shared/shared-main' | 11 | import { VideoChannelService } from '@app/shared/shared-main' |
6 | import { VideoChannelCreate } from '@shared/models' | 12 | import { VideoChannelCreate } from '@shared/models' |
7 | import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' | 13 | import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' |
@@ -17,7 +23,6 @@ export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelE | |||
17 | constructor ( | 23 | constructor ( |
18 | protected formValidatorService: FormValidatorService, | 24 | protected formValidatorService: FormValidatorService, |
19 | private authService: AuthService, | 25 | private authService: AuthService, |
20 | private videoChannelValidatorsService: VideoChannelValidatorsService, | ||
21 | private notifier: Notifier, | 26 | private notifier: Notifier, |
22 | private router: Router, | 27 | private router: Router, |
23 | private videoChannelService: VideoChannelService | 28 | private videoChannelService: VideoChannelService |
@@ -31,10 +36,10 @@ export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelE | |||
31 | 36 | ||
32 | ngOnInit () { | 37 | ngOnInit () { |
33 | this.buildForm({ | 38 | this.buildForm({ |
34 | name: this.videoChannelValidatorsService.VIDEO_CHANNEL_NAME, | 39 | name: VIDEO_CHANNEL_NAME_VALIDATOR, |
35 | 'display-name': this.videoChannelValidatorsService.VIDEO_CHANNEL_DISPLAY_NAME, | 40 | 'display-name': VIDEO_CHANNEL_DISPLAY_NAME_VALIDATOR, |
36 | description: this.videoChannelValidatorsService.VIDEO_CHANNEL_DESCRIPTION, | 41 | description: VIDEO_CHANNEL_DESCRIPTION_VALIDATOR, |
37 | support: this.videoChannelValidatorsService.VIDEO_CHANNEL_SUPPORT | 42 | support: VIDEO_CHANNEL_SUPPORT_VALIDATOR |
38 | }) | 43 | }) |
39 | } | 44 | } |
40 | 45 | ||
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 485521dcc..01659b8da 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 | |||
@@ -2,7 +2,12 @@ import { Subscription } from 'rxjs' | |||
2 | import { Component, OnDestroy, OnInit } from '@angular/core' | 2 | import { Component, OnDestroy, OnInit } from '@angular/core' |
3 | import { ActivatedRoute, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { AuthService, Notifier, ServerService } from '@app/core' | 4 | import { AuthService, Notifier, ServerService } from '@app/core' |
5 | import { FormValidatorService, VideoChannelValidatorsService } from '@app/shared/shared-forms' | 5 | import { |
6 | VIDEO_CHANNEL_DESCRIPTION_VALIDATOR, | ||
7 | VIDEO_CHANNEL_DISPLAY_NAME_VALIDATOR, | ||
8 | VIDEO_CHANNEL_SUPPORT_VALIDATOR | ||
9 | } from '@app/shared/form-validators/video-channel-validators' | ||
10 | import { FormValidatorService } from '@app/shared/shared-forms' | ||
6 | import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' | 11 | import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' |
7 | import { ServerConfig, VideoChannelUpdate } from '@shared/models' | 12 | import { ServerConfig, VideoChannelUpdate } from '@shared/models' |
8 | import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' | 13 | import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' |
@@ -23,7 +28,6 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE | |||
23 | constructor ( | 28 | constructor ( |
24 | protected formValidatorService: FormValidatorService, | 29 | protected formValidatorService: FormValidatorService, |
25 | private authService: AuthService, | 30 | private authService: AuthService, |
26 | private videoChannelValidatorsService: VideoChannelValidatorsService, | ||
27 | private notifier: Notifier, | 31 | private notifier: Notifier, |
28 | private router: Router, | 32 | private router: Router, |
29 | private route: ActivatedRoute, | 33 | private route: ActivatedRoute, |
@@ -39,9 +43,9 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE | |||
39 | .subscribe(config => this.serverConfig = config) | 43 | .subscribe(config => this.serverConfig = config) |
40 | 44 | ||
41 | this.buildForm({ | 45 | this.buildForm({ |
42 | 'display-name': this.videoChannelValidatorsService.VIDEO_CHANNEL_DISPLAY_NAME, | 46 | 'display-name': VIDEO_CHANNEL_DISPLAY_NAME_VALIDATOR, |
43 | description: this.videoChannelValidatorsService.VIDEO_CHANNEL_DESCRIPTION, | 47 | description: VIDEO_CHANNEL_DESCRIPTION_VALIDATOR, |
44 | support: this.videoChannelValidatorsService.VIDEO_CHANNEL_SUPPORT, | 48 | support: VIDEO_CHANNEL_SUPPORT_VALIDATOR, |
45 | bulkVideosSupportUpdate: null | 49 | bulkVideosSupportUpdate: null |
46 | }) | 50 | }) |
47 | 51 | ||
diff --git a/client/src/app/+my-account/my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component.ts b/client/src/app/+my-account/my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component.ts index 3bfffe2da..4c4436755 100644 --- a/client/src/app/+my-account/my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component.ts +++ b/client/src/app/+my-account/my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { AuthService, Notifier } from '@app/core' | 2 | import { AuthService, Notifier } from '@app/core' |
3 | import { FormReactive, FormValidatorService, VideoAcceptOwnershipValidatorsService } from '@app/shared/shared-forms' | 3 | import { OWNERSHIP_CHANGE_CHANNEL_VALIDATOR } from '@app/shared/form-validators/video-ownership-change-validators' |
4 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | ||
4 | import { VideoChannelService, VideoOwnershipService } from '@app/shared/shared-main' | 5 | import { VideoChannelService, VideoOwnershipService } from '@app/shared/shared-main' |
5 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 6 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
6 | import { VideoChangeOwnership, VideoChannel } from '@shared/models' | 7 | import { VideoChangeOwnership, VideoChannel } from '@shared/models' |
@@ -23,7 +24,6 @@ export class MyAccountAcceptOwnershipComponent extends FormReactive implements O | |||
23 | 24 | ||
24 | constructor ( | 25 | constructor ( |
25 | protected formValidatorService: FormValidatorService, | 26 | protected formValidatorService: FormValidatorService, |
26 | private videoChangeOwnershipValidatorsService: VideoAcceptOwnershipValidatorsService, | ||
27 | private videoOwnershipService: VideoOwnershipService, | 27 | private videoOwnershipService: VideoOwnershipService, |
28 | private notifier: Notifier, | 28 | private notifier: Notifier, |
29 | private authService: AuthService, | 29 | private authService: AuthService, |
@@ -40,7 +40,7 @@ export class MyAccountAcceptOwnershipComponent extends FormReactive implements O | |||
40 | .subscribe(videoChannels => this.videoChannels = videoChannels.data) | 40 | .subscribe(videoChannels => this.videoChannels = videoChannels.data) |
41 | 41 | ||
42 | this.buildForm({ | 42 | this.buildForm({ |
43 | channel: this.videoChangeOwnershipValidatorsService.CHANNEL | 43 | channel: OWNERSHIP_CHANGE_CHANNEL_VALIDATOR |
44 | }) | 44 | }) |
45 | } | 45 | } |
46 | 46 | ||
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 index 396936ef3..b2b7849c2 100644 --- 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 | |||
@@ -2,7 +2,8 @@ import { forkJoin } from 'rxjs' | |||
2 | import { tap } from 'rxjs/operators' | 2 | import { tap } from 'rxjs/operators' |
3 | import { Component, OnInit } from '@angular/core' | 3 | import { Component, OnInit } from '@angular/core' |
4 | import { AuthService, ServerService, UserService } from '@app/core' | 4 | import { AuthService, ServerService, UserService } from '@app/core' |
5 | import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' | 5 | import { USER_EMAIL_VALIDATOR, USER_PASSWORD_VALIDATOR } from '@app/shared/form-validators/user-validators' |
6 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | ||
6 | import { User } from '@shared/models' | 7 | import { User } from '@shared/models' |
7 | 8 | ||
8 | @Component({ | 9 | @Component({ |
@@ -17,18 +18,17 @@ export class MyAccountChangeEmailComponent extends FormReactive implements OnIni | |||
17 | 18 | ||
18 | constructor ( | 19 | constructor ( |
19 | protected formValidatorService: FormValidatorService, | 20 | protected formValidatorService: FormValidatorService, |
20 | private userValidatorsService: UserValidatorsService, | ||
21 | private authService: AuthService, | 21 | private authService: AuthService, |
22 | private userService: UserService, | 22 | private userService: UserService, |
23 | private serverService: ServerService | 23 | private serverService: ServerService |
24 | ) { | 24 | ) { |
25 | super() | 25 | super() |
26 | } | 26 | } |
27 | 27 | ||
28 | ngOnInit () { | 28 | ngOnInit () { |
29 | this.buildForm({ | 29 | this.buildForm({ |
30 | 'new-email': this.userValidatorsService.USER_EMAIL, | 30 | 'new-email': USER_EMAIL_VALIDATOR, |
31 | 'password': this.userValidatorsService.USER_PASSWORD | 31 | 'password': USER_PASSWORD_VALIDATOR |
32 | }) | 32 | }) |
33 | 33 | ||
34 | this.user = this.authService.getUser() | 34 | this.user = this.authService.getUser() |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts index 91fe4ec72..ba68bab32 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts | |||
@@ -1,7 +1,8 @@ | |||
1 | import { filter } from 'rxjs/operators' | 1 | import { filter } from 'rxjs/operators' |
2 | import { Component, OnInit } from '@angular/core' | 2 | import { Component, OnInit } from '@angular/core' |
3 | import { AuthService, Notifier, UserService } from '@app/core' | 3 | import { AuthService, Notifier, UserService } from '@app/core' |
4 | import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' | 4 | import { USER_CONFIRM_PASSWORD_VALIDATOR, USER_PASSWORD_VALIDATOR } from '@app/shared/form-validators/user-validators' |
5 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | ||
5 | import { User } from '@shared/models' | 6 | import { User } from '@shared/models' |
6 | 7 | ||
7 | @Component({ | 8 | @Component({ |
@@ -15,7 +16,6 @@ export class MyAccountChangePasswordComponent extends FormReactive implements On | |||
15 | 16 | ||
16 | constructor ( | 17 | constructor ( |
17 | protected formValidatorService: FormValidatorService, | 18 | protected formValidatorService: FormValidatorService, |
18 | private userValidatorsService: UserValidatorsService, | ||
19 | private notifier: Notifier, | 19 | private notifier: Notifier, |
20 | private authService: AuthService, | 20 | private authService: AuthService, |
21 | private userService: UserService | 21 | private userService: UserService |
@@ -25,9 +25,9 @@ export class MyAccountChangePasswordComponent extends FormReactive implements On | |||
25 | 25 | ||
26 | ngOnInit () { | 26 | ngOnInit () { |
27 | this.buildForm({ | 27 | this.buildForm({ |
28 | 'current-password': this.userValidatorsService.USER_PASSWORD, | 28 | 'current-password': USER_PASSWORD_VALIDATOR, |
29 | 'new-password': this.userValidatorsService.USER_PASSWORD, | 29 | 'new-password': USER_PASSWORD_VALIDATOR, |
30 | 'new-confirmed-password': this.userValidatorsService.USER_CONFIRM_PASSWORD | 30 | 'new-confirmed-password': USER_CONFIRM_PASSWORD_VALIDATOR |
31 | }) | 31 | }) |
32 | 32 | ||
33 | this.user = this.authService.getUser() | 33 | this.user = this.authService.getUser() |
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 ed0984bf7..000a2c0ac 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 | |||
@@ -1,7 +1,8 @@ | |||
1 | import { Subject } from 'rxjs' | 1 | import { Subject } from 'rxjs' |
2 | import { Component, Input, OnInit } from '@angular/core' | 2 | import { Component, Input, OnInit } from '@angular/core' |
3 | import { Notifier, User, UserService } from '@app/core' | 3 | import { Notifier, User, UserService } from '@app/core' |
4 | import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' | 4 | import { USER_DESCRIPTION_VALIDATOR, USER_DISPLAY_NAME_REQUIRED_VALIDATOR } from '@app/shared/form-validators/user-validators' |
5 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | ||
5 | 6 | ||
6 | @Component({ | 7 | @Component({ |
7 | selector: 'my-account-profile', | 8 | selector: 'my-account-profile', |
@@ -16,17 +17,16 @@ export class MyAccountProfileComponent extends FormReactive implements OnInit { | |||
16 | 17 | ||
17 | constructor ( | 18 | constructor ( |
18 | protected formValidatorService: FormValidatorService, | 19 | protected formValidatorService: FormValidatorService, |
19 | private userValidatorsService: UserValidatorsService, | ||
20 | private notifier: Notifier, | 20 | private notifier: Notifier, |
21 | private userService: UserService | 21 | private userService: UserService |
22 | ) { | 22 | ) { |
23 | super() | 23 | super() |
24 | } | 24 | } |
25 | 25 | ||
26 | ngOnInit () { | 26 | ngOnInit () { |
27 | this.buildForm({ | 27 | this.buildForm({ |
28 | 'display-name': this.userValidatorsService.USER_DISPLAY_NAME_REQUIRED, | 28 | 'display-name': USER_DISPLAY_NAME_REQUIRED_VALIDATOR, |
29 | description: this.userValidatorsService.USER_DESCRIPTION | 29 | description: USER_DESCRIPTION_VALIDATOR |
30 | }) | 30 | }) |
31 | 31 | ||
32 | this.userInformationLoaded.subscribe(() => { | 32 | this.userInformationLoaded.subscribe(() => { |
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 5427dc3a0..7a80aaa92 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 | |||
@@ -2,7 +2,14 @@ import { Component, OnInit } from '@angular/core' | |||
2 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
3 | import { AuthService, Notifier, ServerService } from '@app/core' | 3 | import { AuthService, Notifier, ServerService } from '@app/core' |
4 | import { populateAsyncUserVideoChannels } from '@app/helpers' | 4 | import { populateAsyncUserVideoChannels } from '@app/helpers' |
5 | import { FormValidatorService, VideoPlaylistValidatorsService } from '@app/shared/shared-forms' | 5 | import { |
6 | setPlaylistChannelValidator, | ||
7 | VIDEO_PLAYLIST_CHANNEL_ID_VALIDATOR, | ||
8 | VIDEO_PLAYLIST_DESCRIPTION_VALIDATOR, | ||
9 | VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR, | ||
10 | VIDEO_PLAYLIST_PRIVACY_VALIDATOR | ||
11 | } from '@app/shared/form-validators/video-playlist-validators' | ||
12 | import { FormValidatorService } from '@app/shared/shared-forms' | ||
6 | import { VideoPlaylistService } from '@app/shared/shared-video-playlist' | 13 | import { VideoPlaylistService } from '@app/shared/shared-video-playlist' |
7 | import { VideoPlaylistCreate } from '@shared/models/videos/playlist/video-playlist-create.model' | 14 | import { VideoPlaylistCreate } from '@shared/models/videos/playlist/video-playlist-create.model' |
8 | import { VideoPlaylistPrivacy } from '@shared/models/videos/playlist/video-playlist-privacy.model' | 15 | import { VideoPlaylistPrivacy } from '@shared/models/videos/playlist/video-playlist-privacy.model' |
@@ -19,7 +26,6 @@ export class MyAccountVideoPlaylistCreateComponent extends MyAccountVideoPlaylis | |||
19 | constructor ( | 26 | constructor ( |
20 | protected formValidatorService: FormValidatorService, | 27 | protected formValidatorService: FormValidatorService, |
21 | private authService: AuthService, | 28 | private authService: AuthService, |
22 | private videoPlaylistValidatorsService: VideoPlaylistValidatorsService, | ||
23 | private notifier: Notifier, | 29 | private notifier: Notifier, |
24 | private router: Router, | 30 | private router: Router, |
25 | private videoPlaylistService: VideoPlaylistService, | 31 | private videoPlaylistService: VideoPlaylistService, |
@@ -30,15 +36,15 @@ export class MyAccountVideoPlaylistCreateComponent extends MyAccountVideoPlaylis | |||
30 | 36 | ||
31 | ngOnInit () { | 37 | ngOnInit () { |
32 | this.buildForm({ | 38 | this.buildForm({ |
33 | displayName: this.videoPlaylistValidatorsService.VIDEO_PLAYLIST_DISPLAY_NAME, | 39 | displayName: VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR, |
34 | privacy: this.videoPlaylistValidatorsService.VIDEO_PLAYLIST_PRIVACY, | 40 | privacy: VIDEO_PLAYLIST_PRIVACY_VALIDATOR, |
35 | description: this.videoPlaylistValidatorsService.VIDEO_PLAYLIST_DESCRIPTION, | 41 | description: VIDEO_PLAYLIST_DESCRIPTION_VALIDATOR, |
36 | videoChannelId: this.videoPlaylistValidatorsService.VIDEO_PLAYLIST_CHANNEL_ID, | 42 | videoChannelId: VIDEO_PLAYLIST_CHANNEL_ID_VALIDATOR, |
37 | thumbnailfile: null | 43 | thumbnailfile: null |
38 | }) | 44 | }) |
39 | 45 | ||
40 | this.form.get('privacy').valueChanges.subscribe(privacy => { | 46 | this.form.get('privacy').valueChanges.subscribe(privacy => { |
41 | this.videoPlaylistValidatorsService.setChannelValidator(this.form.get('videoChannelId'), privacy) | 47 | setPlaylistChannelValidator(this.form.get('videoChannelId'), privacy) |
42 | }) | 48 | }) |
43 | 49 | ||
44 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) | 50 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) |
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 149d0d94f..fefc6d607 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 | |||
@@ -4,7 +4,14 @@ import { Component, OnDestroy, OnInit } from '@angular/core' | |||
4 | import { ActivatedRoute, Router } from '@angular/router' | 4 | import { ActivatedRoute, Router } from '@angular/router' |
5 | import { AuthService, Notifier, ServerService } from '@app/core' | 5 | import { AuthService, Notifier, ServerService } from '@app/core' |
6 | import { populateAsyncUserVideoChannels } from '@app/helpers' | 6 | import { populateAsyncUserVideoChannels } from '@app/helpers' |
7 | import { FormValidatorService, VideoPlaylistValidatorsService } from '@app/shared/shared-forms' | 7 | import { |
8 | setPlaylistChannelValidator, | ||
9 | VIDEO_PLAYLIST_CHANNEL_ID_VALIDATOR, | ||
10 | VIDEO_PLAYLIST_DESCRIPTION_VALIDATOR, | ||
11 | VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR, | ||
12 | VIDEO_PLAYLIST_PRIVACY_VALIDATOR | ||
13 | } from '@app/shared/form-validators/video-playlist-validators' | ||
14 | import { FormValidatorService } from '@app/shared/shared-forms' | ||
8 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' | 15 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' |
9 | import { VideoPlaylistUpdate } from '@shared/models' | 16 | import { VideoPlaylistUpdate } from '@shared/models' |
10 | import { MyAccountVideoPlaylistEdit } from './my-account-video-playlist-edit' | 17 | import { MyAccountVideoPlaylistEdit } from './my-account-video-playlist-edit' |
@@ -23,7 +30,6 @@ export class MyAccountVideoPlaylistUpdateComponent extends MyAccountVideoPlaylis | |||
23 | constructor ( | 30 | constructor ( |
24 | protected formValidatorService: FormValidatorService, | 31 | protected formValidatorService: FormValidatorService, |
25 | private authService: AuthService, | 32 | private authService: AuthService, |
26 | private videoPlaylistValidatorsService: VideoPlaylistValidatorsService, | ||
27 | private notifier: Notifier, | 33 | private notifier: Notifier, |
28 | private router: Router, | 34 | private router: Router, |
29 | private route: ActivatedRoute, | 35 | private route: ActivatedRoute, |
@@ -35,15 +41,15 @@ export class MyAccountVideoPlaylistUpdateComponent extends MyAccountVideoPlaylis | |||
35 | 41 | ||
36 | ngOnInit () { | 42 | ngOnInit () { |
37 | this.buildForm({ | 43 | this.buildForm({ |
38 | displayName: this.videoPlaylistValidatorsService.VIDEO_PLAYLIST_DISPLAY_NAME, | 44 | displayName: VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR, |
39 | privacy: this.videoPlaylistValidatorsService.VIDEO_PLAYLIST_PRIVACY, | 45 | privacy: VIDEO_PLAYLIST_PRIVACY_VALIDATOR, |
40 | description: this.videoPlaylistValidatorsService.VIDEO_PLAYLIST_DESCRIPTION, | 46 | description: VIDEO_PLAYLIST_DESCRIPTION_VALIDATOR, |
41 | videoChannelId: this.videoPlaylistValidatorsService.VIDEO_PLAYLIST_CHANNEL_ID, | 47 | videoChannelId: VIDEO_PLAYLIST_CHANNEL_ID_VALIDATOR, |
42 | thumbnailfile: null | 48 | thumbnailfile: null |
43 | }) | 49 | }) |
44 | 50 | ||
45 | this.form.get('privacy').valueChanges.subscribe(privacy => { | 51 | this.form.get('privacy').valueChanges.subscribe(privacy => { |
46 | this.videoPlaylistValidatorsService.setChannelValidator(this.form.get('videoChannelId'), privacy) | 52 | setPlaylistChannelValidator(this.form.get('videoChannelId'), privacy) |
47 | }) | 53 | }) |
48 | 54 | ||
49 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) | 55 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) |
diff --git a/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts b/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts index edd691694..84237dee1 100644 --- a/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts +++ b/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' |
2 | import { Notifier, UserService } from '@app/core' | 2 | import { Notifier, UserService } from '@app/core' |
3 | import { FormReactive, FormValidatorService, VideoChangeOwnershipValidatorsService } from '@app/shared/shared-forms' | 3 | import { OWNERSHIP_CHANGE_USERNAME_VALIDATOR } from '@app/shared/form-validators/video-ownership-change-validators' |
4 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | ||
4 | import { Video, VideoOwnershipService } from '@app/shared/shared-main' | 5 | import { Video, VideoOwnershipService } from '@app/shared/shared-main' |
5 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 6 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
6 | 7 | ||
@@ -20,7 +21,6 @@ export class VideoChangeOwnershipComponent extends FormReactive implements OnIni | |||
20 | 21 | ||
21 | constructor ( | 22 | constructor ( |
22 | protected formValidatorService: FormValidatorService, | 23 | protected formValidatorService: FormValidatorService, |
23 | private videoChangeOwnershipValidatorsService: VideoChangeOwnershipValidatorsService, | ||
24 | private videoOwnershipService: VideoOwnershipService, | 24 | private videoOwnershipService: VideoOwnershipService, |
25 | private notifier: Notifier, | 25 | private notifier: Notifier, |
26 | private userService: UserService, | 26 | private userService: UserService, |
@@ -31,7 +31,7 @@ export class VideoChangeOwnershipComponent extends FormReactive implements OnIni | |||
31 | 31 | ||
32 | ngOnInit () { | 32 | ngOnInit () { |
33 | this.buildForm({ | 33 | this.buildForm({ |
34 | username: this.videoChangeOwnershipValidatorsService.USERNAME | 34 | username: OWNERSHIP_CHANGE_USERNAME_VALIDATOR |
35 | }) | 35 | }) |
36 | this.usernamePropositions = [] | 36 | this.usernamePropositions = [] |
37 | } | 37 | } |