aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos/+video-edit/video-add-components
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-07-04 11:31:22 +0200
committerChocobozzz <me@florianbigard.com>2022-07-04 11:31:22 +0200
commit0146f3516ec458d7eaba3ede2addb23005bd4a28 (patch)
tree6a7742feb5087af2d62c0478751678e93837a56f /client/src/app/+videos/+video-edit/video-add-components
parentcd25344f741e8c97b113b36eb6babc7be490114d (diff)
downloadPeerTube-0146f3516ec458d7eaba3ede2addb23005bd4a28.tar.gz
PeerTube-0146f3516ec458d7eaba3ede2addb23005bd4a28.tar.zst
PeerTube-0146f3516ec458d7eaba3ede2addb23005bd4a28.zip
Fix comments/download attributes on import
Diffstat (limited to 'client/src/app/+videos/+video-edit/video-add-components')
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts16
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts34
2 files changed, 15 insertions, 35 deletions
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts
index c369ba2b7..da4996902 100644
--- a/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts
+++ b/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts
@@ -1,3 +1,4 @@
1import { switchMap } from 'rxjs'
1import { AfterViewInit, Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' 2import { AfterViewInit, Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core'
2import { Router } from '@angular/router' 3import { Router } from '@angular/router'
3import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService } from '@app/core' 4import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService } from '@app/core'
@@ -87,21 +88,16 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Af
87 this.loadingBar.useRef().start() 88 this.loadingBar.useRef().start()
88 89
89 this.videoImportService.importVideoTorrent(torrentfile || this.magnetUri, videoUpdate) 90 this.videoImportService.importVideoTorrent(torrentfile || this.magnetUri, videoUpdate)
91 .pipe(switchMap(({ video }) => this.videoService.getVideo({ videoId: video.uuid })))
90 .subscribe({ 92 .subscribe({
91 next: res => { 93 next: video => {
92 this.loadingBar.useRef().complete() 94 this.loadingBar.useRef().complete()
93 this.firstStepDone.emit(res.video.name) 95 this.firstStepDone.emit(video.name)
94 this.isImportingVideo = false 96 this.isImportingVideo = false
95 this.hasImportedVideo = true 97 this.hasImportedVideo = true
96 98
97 this.video = new VideoEdit(Object.assign(res.video, { 99 this.video = new VideoEdit(video)
98 commentsEnabled: videoUpdate.commentsEnabled, 100 this.video.patch({ privacy: this.firstStepPrivacyId })
99 downloadEnabled: videoUpdate.downloadEnabled,
100 privacy: { id: this.firstStepPrivacyId },
101 support: null,
102 thumbnailUrl: null,
103 previewUrl: null
104 }))
105 101
106 hydrateFormFromVideo(this.form, this.video, false) 102 hydrateFormFromVideo(this.form, this.video, false)
107 }, 103 },
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 @@
1import { forkJoin } from 'rxjs'
1import { map, switchMap } from 'rxjs/operators' 2import { map, switchMap } from 'rxjs/operators'
2import { AfterViewInit, Component, EventEmitter, OnInit, Output } from '@angular/core' 3import { AfterViewInit, Component, EventEmitter, OnInit, Output } from '@angular/core'
3import { Router } from '@angular/router' 4import { Router } from '@angular/router'
4import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService } from '@app/core' 5import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService } from '@app/core'
5import { getAbsoluteAPIUrl, scrollToTop } from '@app/helpers' 6import { scrollToTop } from '@app/helpers'
6import { FormValidatorService } from '@app/shared/shared-forms' 7import { FormValidatorService } from '@app/shared/shared-forms'
7import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' 8import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main'
8import { LoadingBarService } from '@ngx-loading-bar/core' 9import { LoadingBarService } from '@ngx-loading-bar/core'
@@ -76,12 +77,11 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterV
76 this.videoImportService 77 this.videoImportService
77 .importVideoUrl(this.targetUrl, videoUpdate) 78 .importVideoUrl(this.targetUrl, videoUpdate)
78 .pipe( 79 .pipe(
79 switchMap(res => { 80 switchMap(previous => {
80 return this.videoCaptionService 81 return forkJoin([
81 .listCaptions(res.video.uuid) 82 this.videoCaptionService.listCaptions(previous.video.uuid),
82 .pipe( 83 this.videoService.getVideo({ videoId: previous.video.uuid })
83 map(result => ({ video: res.video, videoCaptions: result.data })) 84 ]).pipe(map(([ videoCaptionsResult, video ]) => ({ videoCaptions: videoCaptionsResult.data, video })))
84 )
85 }) 85 })
86 ) 86 )
87 .subscribe({ 87 .subscribe({
@@ -91,24 +91,8 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterV
91 this.isImportingVideo = false 91 this.isImportingVideo = false
92 this.hasImportedVideo = true 92 this.hasImportedVideo = true
93 93
94 const absoluteAPIUrl = getAbsoluteAPIUrl() 94 this.video = new VideoEdit(video)
95 95 this.video.patch({ privacy: this.firstStepPrivacyId })
96 const thumbnailUrl = video.thumbnailPath
97 ? absoluteAPIUrl + video.thumbnailPath
98 : null
99
100 const previewUrl = video.previewPath
101 ? absoluteAPIUrl + video.previewPath
102 : null
103
104 this.video = new VideoEdit(Object.assign(video, {
105 commentsEnabled: videoUpdate.commentsEnabled,
106 downloadEnabled: videoUpdate.downloadEnabled,
107 privacy: { id: this.firstStepPrivacyId },
108 support: null,
109 thumbnailUrl,
110 previewUrl
111 }))
112 96
113 this.videoCaptions = videoCaptions 97 this.videoCaptions = videoCaptions
114 98