diff options
author | Chocobozzz <me@florianbigard.com> | 2022-07-04 11:31:22 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-07-04 11:31:22 +0200 |
commit | 0146f3516ec458d7eaba3ede2addb23005bd4a28 (patch) | |
tree | 6a7742feb5087af2d62c0478751678e93837a56f /client/src/app/+videos/+video-edit/video-update.component.ts | |
parent | cd25344f741e8c97b113b36eb6babc7be490114d (diff) | |
download | PeerTube-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-update.component.ts')
-rw-r--r-- | client/src/app/+videos/+video-edit/video-update.component.ts | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/client/src/app/+videos/+video-edit/video-update.component.ts b/client/src/app/+videos/+video-edit/video-update.component.ts index 43e8ba3e5..13e786a8e 100644 --- a/client/src/app/+videos/+video-edit/video-update.component.ts +++ b/client/src/app/+videos/+video-edit/video-update.component.ts | |||
@@ -18,7 +18,7 @@ import { VideoSource } from '@shared/models/videos/video-source' | |||
18 | templateUrl: './video-update.component.html' | 18 | templateUrl: './video-update.component.html' |
19 | }) | 19 | }) |
20 | export class VideoUpdateComponent extends FormReactive implements OnInit { | 20 | export class VideoUpdateComponent extends FormReactive implements OnInit { |
21 | video: VideoEdit | 21 | videoEdit: VideoEdit |
22 | videoDetails: VideoDetails | 22 | videoDetails: VideoDetails |
23 | videoSource: VideoSource | 23 | videoSource: VideoSource |
24 | userVideoChannels: SelectChannelItem[] = [] | 24 | userVideoChannels: SelectChannelItem[] = [] |
@@ -50,19 +50,19 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
50 | const { videoData } = this.route.snapshot.data | 50 | const { videoData } = this.route.snapshot.data |
51 | const { video, videoChannels, videoCaptions, videoSource, liveVideo } = videoData | 51 | const { video, videoChannels, videoCaptions, videoSource, liveVideo } = videoData |
52 | 52 | ||
53 | this.video = new VideoEdit(video) | ||
54 | this.videoDetails = video | 53 | this.videoDetails = video |
54 | this.videoEdit = new VideoEdit(this.videoDetails) | ||
55 | 55 | ||
56 | this.userVideoChannels = videoChannels | 56 | this.userVideoChannels = videoChannels |
57 | this.videoCaptions = videoCaptions | 57 | this.videoCaptions = videoCaptions |
58 | this.videoSource = videoSource | 58 | this.videoSource = videoSource |
59 | this.liveVideo = liveVideo | 59 | this.liveVideo = liveVideo |
60 | 60 | ||
61 | this.forbidScheduledPublication = this.video.privacy !== VideoPrivacy.PRIVATE | 61 | this.forbidScheduledPublication = this.videoEdit.privacy !== VideoPrivacy.PRIVATE |
62 | } | 62 | } |
63 | 63 | ||
64 | onFormBuilt () { | 64 | onFormBuilt () { |
65 | hydrateFormFromVideo(this.form, this.video, true) | 65 | hydrateFormFromVideo(this.form, this.videoEdit, true) |
66 | 66 | ||
67 | if (this.liveVideo) { | 67 | if (this.liveVideo) { |
68 | this.form.patchValue({ | 68 | this.form.patchValue({ |
@@ -115,16 +115,16 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
115 | return | 115 | return |
116 | } | 116 | } |
117 | 117 | ||
118 | this.video.patch(this.form.value) | 118 | this.videoEdit.patch(this.form.value) |
119 | 119 | ||
120 | this.loadingBar.useRef().start() | 120 | this.loadingBar.useRef().start() |
121 | this.isUpdatingVideo = true | 121 | this.isUpdatingVideo = true |
122 | 122 | ||
123 | // Update the video | 123 | // Update the video |
124 | this.videoService.updateVideo(this.video) | 124 | this.videoService.updateVideo(this.videoEdit) |
125 | .pipe( | 125 | .pipe( |
126 | // Then update captions | 126 | // Then update captions |
127 | switchMap(() => this.videoCaptionService.updateCaptions(this.video.id, this.videoCaptions)), | 127 | switchMap(() => this.videoCaptionService.updateCaptions(this.videoEdit.id, this.videoCaptions)), |
128 | 128 | ||
129 | switchMap(() => { | 129 | switchMap(() => { |
130 | if (!this.liveVideo) return of(undefined) | 130 | if (!this.liveVideo) return of(undefined) |
@@ -140,7 +140,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
140 | .some(key => this.liveVideo[key] !== liveVideoUpdate[key]) | 140 | .some(key => this.liveVideo[key] !== liveVideoUpdate[key]) |
141 | if (!liveChanged) return of(undefined) | 141 | if (!liveChanged) return of(undefined) |
142 | 142 | ||
143 | return this.liveVideoService.updateLive(this.video.id, liveVideoUpdate) | 143 | return this.liveVideoService.updateLive(this.videoEdit.id, liveVideoUpdate) |
144 | }) | 144 | }) |
145 | ) | 145 | ) |
146 | .subscribe({ | 146 | .subscribe({ |
@@ -149,7 +149,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
149 | this.isUpdatingVideo = false | 149 | this.isUpdatingVideo = false |
150 | this.loadingBar.useRef().complete() | 150 | this.loadingBar.useRef().complete() |
151 | this.notifier.success($localize`Video updated.`) | 151 | this.notifier.success($localize`Video updated.`) |
152 | this.router.navigateByUrl(Video.buildWatchUrl(this.video)) | 152 | this.router.navigateByUrl(Video.buildWatchUrl(this.videoEdit)) |
153 | }, | 153 | }, |
154 | 154 | ||
155 | error: err => { | 155 | error: err => { |
@@ -162,10 +162,10 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
162 | } | 162 | } |
163 | 163 | ||
164 | hydratePluginFieldsFromVideo () { | 164 | hydratePluginFieldsFromVideo () { |
165 | if (!this.video.pluginData) return | 165 | if (!this.videoEdit.pluginData) return |
166 | 166 | ||
167 | this.form.patchValue({ | 167 | this.form.patchValue({ |
168 | pluginData: this.video.pluginData | 168 | pluginData: this.videoEdit.pluginData |
169 | }) | 169 | }) |
170 | } | 170 | } |
171 | 171 | ||