Don't update live attributes if they did not change

pull/3383/head
Chocobozzz 2021-01-26 15:28:38 +01:00
parent e9cb361cf5
commit fd0fdc4696
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 13 additions and 5 deletions

View File

@ -124,11 +124,6 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
this.video.patch(this.form.value)
const liveVideoUpdate: LiveVideoUpdate = {
saveReplay: this.form.value.saveReplay,
permanentLive: this.form.value.permanentLive
}
this.loadingBar.useRef().start()
this.isUpdatingVideo = true
@ -141,6 +136,19 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
switchMap(() => {
if (!this.liveVideo) return of(undefined)
const liveVideoUpdate: LiveVideoUpdate = {
saveReplay: this.form.value.saveReplay,
permanentLive: this.form.value.permanentLive
}
console.log(liveVideoUpdate)
console.log(this.form.value)
// Don't update live attributes if they did not change
const liveChanged = Object.keys(liveVideoUpdate)
.some(key => this.liveVideo[key] !== liveVideoUpdate[key])
if (!liveChanged) return of(undefined)
return this.liveVideoService.updateLive(this.video.id, liveVideoUpdate)
})
)