schedulePublicationPossible = false
videoCaptions: VideoCaptionEdit[] = []
+ private updateDone = false
+
constructor (
protected formValidatorService: FormValidatorService,
private route: ActivatedRoute,
this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE
}
- // FIXME: Angular does not detec
+ // FIXME: Angular does not detect the change inside this subscription, so use the patched setTimeout
setTimeout(() => this.hydrateFormFromVideo())
},
)
}
+ canDeactivate () {
+ if (this.updateDone === true) return { canDeactivate: true }
+
+ for (const caption of this.videoCaptions) {
+ if (caption.action) return { canDeactivate: false }
+ }
+
+ return { canDeactivate: this.formChanged === false }
+ }
+
checkForm () {
this.forceCheck()
)
.subscribe(
() => {
+ this.updateDone = true
this.isUpdatingVideo = false
this.loadingBar.complete()
this.notificationsService.success(this.i18n('Success'), this.i18n('Video updated.'))
console.error(err)
}
)
-
}
private hydrateFormFromVideo () {