Fix video support field update
This commit is contained in:
parent
e4a686b4a2
commit
6f79be110d
1 changed files with 17 additions and 13 deletions
|
@ -248,17 +248,20 @@ export class VideoEditComponent implements OnInit, OnDestroy {
|
||||||
.subscribe(
|
.subscribe(
|
||||||
newChannelId => {
|
newChannelId => {
|
||||||
const oldChannelId = parseInt(this.form.value[ 'channelId' ], 10)
|
const oldChannelId = parseInt(this.form.value[ 'channelId' ], 10)
|
||||||
const currentSupport = this.form.value[ 'support' ]
|
|
||||||
|
|
||||||
// Not initialized yet
|
// Not initialized yet
|
||||||
if (isNaN(newChannelId)) return
|
if (isNaN(newChannelId)) return
|
||||||
const newChannel = this.userVideoChannels.find(c => c.id === newChannelId)
|
const newChannel = this.userVideoChannels.find(c => c.id === newChannelId)
|
||||||
if (!newChannel) return
|
if (!newChannel) return
|
||||||
|
|
||||||
// First time we set the channel?
|
// Wait support field update
|
||||||
if (isNaN(oldChannelId)) return this.updateSupportField(newChannel.support)
|
setTimeout(() => {
|
||||||
const oldChannel = this.userVideoChannels.find(c => c.id === oldChannelId)
|
const currentSupport = this.form.value[ 'support' ]
|
||||||
|
|
||||||
|
// First time we set the channel?
|
||||||
|
if (isNaN(oldChannelId) && !currentSupport) return this.updateSupportField(newChannel.support)
|
||||||
|
|
||||||
|
const oldChannel = this.userVideoChannels.find(c => c.id === oldChannelId)
|
||||||
if (!newChannel || !oldChannel) {
|
if (!newChannel || !oldChannel) {
|
||||||
console.error('Cannot find new or old channel.')
|
console.error('Cannot find new or old channel.')
|
||||||
return
|
return
|
||||||
|
@ -270,6 +273,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
// Update the support text with our new channel
|
// Update the support text with our new channel
|
||||||
this.updateSupportField(newChannel.support)
|
this.updateSupportField(newChannel.support)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue