- .subscribe(
- video => {
- this.video = new VideoEdit(video)
-
- this.hydrateFormFromVideo()
- },
-
- err => {
- console.error(err)
- this.error = 'Cannot fetch video.'
- }
- )
+ .switchMap(video => {
+ return this.videoService
+ .loadCompleteDescription(video.descriptionPath)
+ .do(description => video.description = description)
+ .map(() => video)
+ })
+ .subscribe(
+ video => {
+ this.video = new VideoEdit(video)
+
+ // We cannot set private a video that was not private
+ if (video.privacy !== VideoPrivacy.PRIVATE) {
+ const newVideoPrivacies = []
+ for (const p of this.videoPrivacies) {
+ if (p.id !== VideoPrivacy.PRIVATE) newVideoPrivacies.push(p)
+ }
+
+ this.videoPrivacies = newVideoPrivacies
+ }
+
+ this.hydrateFormFromVideo()
+ },
+
+ err => {
+ console.error(err)
+ this.notificationsService.error('Error', err.message)
+ }
+ )