aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.component.ts30
1 files changed, 17 insertions, 13 deletions
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.ts b/client/src/app/videos/+video-edit/shared/video-edit.component.ts
index 982e071ad..15073fc44 100644
--- a/client/src/app/videos/+video-edit/shared/video-edit.component.ts
+++ b/client/src/app/videos/+video-edit/shared/video-edit.component.ts
@@ -248,28 +248,32 @@ export class VideoEditComponent implements OnInit, OnDestroy {
248 .subscribe( 248 .subscribe(
249 newChannelId => { 249 newChannelId => {
250 const oldChannelId = parseInt(this.form.value[ 'channelId' ], 10) 250 const oldChannelId = parseInt(this.form.value[ 'channelId' ], 10)
251 const currentSupport = this.form.value[ 'support' ]
252 251
253 // Not initialized yet 252 // Not initialized yet
254 if (isNaN(newChannelId)) return 253 if (isNaN(newChannelId)) return
255 const newChannel = this.userVideoChannels.find(c => c.id === newChannelId) 254 const newChannel = this.userVideoChannels.find(c => c.id === newChannelId)
256 if (!newChannel) return 255 if (!newChannel) return
257 256
258 // First time we set the channel? 257 // Wait support field update
259 if (isNaN(oldChannelId)) return this.updateSupportField(newChannel.support) 258 setTimeout(() => {
260 const oldChannel = this.userVideoChannels.find(c => c.id === oldChannelId) 259 const currentSupport = this.form.value[ 'support' ]
261 260
262 if (!newChannel || !oldChannel) { 261 // First time we set the channel?
263 console.error('Cannot find new or old channel.') 262 if (isNaN(oldChannelId) && !currentSupport) return this.updateSupportField(newChannel.support)
264 return 263
265 } 264 const oldChannel = this.userVideoChannels.find(c => c.id === oldChannelId)
265 if (!newChannel || !oldChannel) {
266 console.error('Cannot find new or old channel.')
267 return
268 }
266 269
267 // If the current support text is not the same than the old channel, the user updated it. 270 // If the current support text is not the same than the old channel, the user updated it.
268 // We don't want the user to lose his text, so stop here 271 // We don't want the user to lose his text, so stop here
269 if (currentSupport && currentSupport !== oldChannel.support) return 272 if (currentSupport && currentSupport !== oldChannel.support) return
270 273
271 // Update the support text with our new channel 274 // Update the support text with our new channel
272 this.updateSupportField(newChannel.support) 275 this.updateSupportField(newChannel.support)
276 })
273 } 277 }
274 ) 278 )
275 } 279 }