+ this.form.controls[ 'privacy' ]
+ .valueChanges
+ .pipe(map(res => parseInt(res.toString(), 10)))
+ .subscribe(
+ newPrivacyId => {
+ this.schedulePublicationEnabled = newPrivacyId === this.SPECIAL_SCHEDULED_PRIVACY
+
+ // Value changed
+ const scheduleControl = this.form.get('schedulePublicationAt')
+ const waitTranscodingControl = this.form.get('waitTranscoding')
+
+ if (this.schedulePublicationEnabled) {
+ scheduleControl.setValidators([ Validators.required ])
+
+ waitTranscodingControl.disable()
+ waitTranscodingControl.setValue(false)
+ } else {
+ scheduleControl.clearValidators()
+
+ waitTranscodingControl.enable()
+ waitTranscodingControl.setValue(true)
+ }
+
+ scheduleControl.updateValueAndValidity()
+ waitTranscodingControl.updateValueAndValidity()
+ }
+ )
+ }
+
+ private trackChannelChange () {
+ // We will update the "support" field depending on the channel
+ this.form.controls[ 'channelId' ]