X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=client%2Fsrc%2Fapp%2F%2Bvideos%2F%2Bvideo-edit%2Fvideo-add-components%2Fvideo-import-url.component.ts;h=971a2a070edac6f3386aa91e79ffc16ad0a037bd;hb=0146f3516ec458d7eaba3ede2addb23005bd4a28;hp=4c74eda845fffc60dccc658b0001044b0f6c1765;hpb=e722fb5923ddf11d72e48cec9788abc64327c22f;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts index 4c74eda84..971a2a070 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts @@ -1,8 +1,9 @@ +import { forkJoin } from 'rxjs' import { map, switchMap } from 'rxjs/operators' import { AfterViewInit, Component, EventEmitter, OnInit, Output } from '@angular/core' import { Router } from '@angular/router' import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService } from '@app/core' -import { getAbsoluteAPIUrl, scrollToTop } from '@app/helpers' +import { scrollToTop } from '@app/helpers' import { FormValidatorService } from '@app/shared/shared-forms' import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' import { LoadingBarService } from '@ngx-loading-bar/core' @@ -76,12 +77,11 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterV this.videoImportService .importVideoUrl(this.targetUrl, videoUpdate) .pipe( - switchMap(res => { - return this.videoCaptionService - .listCaptions(res.video.uuid) - .pipe( - map(result => ({ video: res.video, videoCaptions: result.data })) - ) + switchMap(previous => { + return forkJoin([ + this.videoCaptionService.listCaptions(previous.video.uuid), + this.videoService.getVideo({ videoId: previous.video.uuid }) + ]).pipe(map(([ videoCaptionsResult, video ]) => ({ videoCaptions: videoCaptionsResult.data, video }))) }) ) .subscribe({ @@ -91,24 +91,8 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterV this.isImportingVideo = false this.hasImportedVideo = true - const absoluteAPIUrl = getAbsoluteAPIUrl() - - const thumbnailUrl = video.thumbnailPath - ? absoluteAPIUrl + video.thumbnailPath - : null - - const previewUrl = video.previewPath - ? absoluteAPIUrl + video.previewPath - : null - - this.video = new VideoEdit(Object.assign(video, { - commentsEnabled: videoUpdate.commentsEnabled, - downloadEnabled: videoUpdate.downloadEnabled, - privacy: { id: this.firstStepPrivacyId }, - support: null, - thumbnailUrl, - previewUrl - })) + this.video = new VideoEdit(video) + this.video.patch({ privacy: this.firstStepPrivacyId }) this.videoCaptions = videoCaptions