diff options
Diffstat (limited to 'client/src/app/videos/+video-edit/video-add.component.ts')
-rw-r--r-- | client/src/app/videos/+video-edit/video-add.component.ts | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/client/src/app/videos/+video-edit/video-add.component.ts b/client/src/app/videos/+video-edit/video-add.component.ts index 92b03e8c9..5b5557ed9 100644 --- a/client/src/app/videos/+video-edit/video-add.component.ts +++ b/client/src/app/videos/+video-edit/video-add.component.ts | |||
@@ -82,7 +82,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
82 | category: [ '', VIDEO_CATEGORY.VALIDATORS ], | 82 | category: [ '', VIDEO_CATEGORY.VALIDATORS ], |
83 | licence: [ '', VIDEO_LICENCE.VALIDATORS ], | 83 | licence: [ '', VIDEO_LICENCE.VALIDATORS ], |
84 | language: [ '', VIDEO_LANGUAGE.VALIDATORS ], | 84 | language: [ '', VIDEO_LANGUAGE.VALIDATORS ], |
85 | channelId: [ this.userVideoChannels[0].id, VIDEO_CHANNEL.VALIDATORS ], | 85 | channelId: [ '', VIDEO_CHANNEL.VALIDATORS ], |
86 | description: [ '', VIDEO_DESCRIPTION.VALIDATORS ], | 86 | description: [ '', VIDEO_DESCRIPTION.VALIDATORS ], |
87 | videofile: [ '', VIDEO_FILE.VALIDATORS ], | 87 | videofile: [ '', VIDEO_FILE.VALIDATORS ], |
88 | tags: [ '' ] | 88 | tags: [ '' ] |
@@ -96,10 +96,22 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
96 | this.videoLicences = this.serverService.getVideoLicences() | 96 | this.videoLicences = this.serverService.getVideoLicences() |
97 | this.videoLanguages = this.serverService.getVideoLanguages() | 97 | this.videoLanguages = this.serverService.getVideoLanguages() |
98 | 98 | ||
99 | const user = this.authService.getUser() | ||
100 | this.userVideoChannels = user.videoChannels.map(v => ({ id: v.id, label: v.name })) | ||
101 | |||
102 | this.buildForm() | 99 | this.buildForm() |
100 | |||
101 | this.authService.userInformationLoaded | ||
102 | .subscribe( | ||
103 | () => { | ||
104 | const user = this.authService.getUser() | ||
105 | if (!user) return | ||
106 | |||
107 | const videoChannels = user.videoChannels | ||
108 | if (Array.isArray(videoChannels) === false) return | ||
109 | |||
110 | this.userVideoChannels = videoChannels.map(v => ({ id: v.id, label: v.name })) | ||
111 | |||
112 | this.form.patchValue({ channelId: this.userVideoChannels[0].id }) | ||
113 | } | ||
114 | ) | ||
103 | } | 115 | } |
104 | 116 | ||
105 | // The goal is to keep reactive form validation (required field) | 117 | // The goal is to keep reactive form validation (required field) |