- this.formErrors['name'] = ''
- this.formErrors['privacy'] = ''
- this.formErrors['channelId'] = ''
- this.formErrors['category'] = ''
- this.formErrors['licence'] = ''
- this.formErrors['language'] = ''
- this.formErrors['description'] = ''
- this.formErrors['thumbnailfile'] = ''
- this.formErrors['previewfile'] = ''
- this.formErrors['support'] = ''
-
- this.validationMessages['name'] = VIDEO_NAME.MESSAGES
- this.validationMessages['privacy'] = VIDEO_PRIVACY.MESSAGES
- this.validationMessages['channelId'] = VIDEO_CHANNEL.MESSAGES
- this.validationMessages['category'] = VIDEO_CATEGORY.MESSAGES
- this.validationMessages['licence'] = VIDEO_LICENCE.MESSAGES
- this.validationMessages['language'] = VIDEO_LANGUAGE.MESSAGES
- this.validationMessages['description'] = VIDEO_DESCRIPTION.MESSAGES
- this.validationMessages['thumbnailfile'] = VIDEO_IMAGE.MESSAGES
- this.validationMessages['previewfile'] = VIDEO_IMAGE.MESSAGES
- this.validationMessages['support'] = VIDEO_SUPPORT.MESSAGES
-
- this.form.addControl('name', new FormControl('', VIDEO_NAME.VALIDATORS))
- this.form.addControl('privacy', new FormControl('', VIDEO_PRIVACY.VALIDATORS))
- this.form.addControl('channelId', new FormControl({ value: '', disabled: true }))
- this.form.addControl('nsfw', new FormControl(false))
- this.form.addControl('commentsEnabled', new FormControl(true))
- this.form.addControl('category', new FormControl('', VIDEO_CATEGORY.VALIDATORS))
- this.form.addControl('licence', new FormControl('', VIDEO_LICENCE.VALIDATORS))
- this.form.addControl('language', new FormControl('', VIDEO_LANGUAGE.VALIDATORS))
- this.form.addControl('description', new FormControl('', VIDEO_DESCRIPTION.VALIDATORS))
- this.form.addControl('tags', new FormControl(''))
- this.form.addControl('thumbnailfile', new FormControl(''))
- this.form.addControl('previewfile', new FormControl(''))
- this.form.addControl('support', new FormControl(''))
+ const defaultValues = {
+ nsfw: 'false',
+ commentsEnabled: 'true',
+ waitTranscoding: 'true',
+ tags: []
+ }
+ const obj = {
+ name: this.videoValidatorsService.VIDEO_NAME,
+ privacy: this.videoValidatorsService.VIDEO_PRIVACY,
+ channelId: this.videoValidatorsService.VIDEO_CHANNEL,
+ nsfw: null,
+ commentsEnabled: null,
+ waitTranscoding: null,
+ category: this.videoValidatorsService.VIDEO_CATEGORY,
+ licence: this.videoValidatorsService.VIDEO_LICENCE,
+ language: this.videoValidatorsService.VIDEO_LANGUAGE,
+ description: this.videoValidatorsService.VIDEO_DESCRIPTION,
+ tags: null,
+ thumbnailfile: null,
+ previewfile: null,
+ support: this.videoValidatorsService.VIDEO_SUPPORT,
+ schedulePublicationAt: this.videoValidatorsService.VIDEO_SCHEDULE_PUBLICATION_AT
+ }
+
+ this.formValidatorService.updateForm(
+ this.form,
+ this.formErrors,
+ this.validationMessages,
+ obj,
+ defaultValues
+ )
+
+ this.trackChannelChange()
+ this.trackPrivacyChange()