import { HTMLServerConfig, VideoConstant, VideoPrivacy } from '@shared/models'
@Directive()
-// tslint:disable-next-line: directive-class-suffix
+// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class VideoSend extends FormReactive implements OnInit {
userVideoChannels: SelectChannelItem[] = []
videoPrivacies: VideoConstant<VideoPrivacy>[] = []
videoCaptions: VideoCaptionEdit[] = []
- firstStepPrivacyId = 0
- firstStepChannelId = 0
+ firstStepPrivacyId: VideoPrivacy
+ firstStepChannelId: number
abstract firstStepDone: EventEmitter<string>
abstract firstStepError: EventEmitter<void>
protected loadingBar: LoadingBarService
protected notifier: Notifier
protected authService: AuthService
+
protected serverService: ServerService
protected videoService: VideoService
protected videoCaptionService: VideoCaptionService
+
protected serverConfig: HTMLServerConfig
+ protected highestPrivacy: VideoPrivacy
+
abstract canDeactivate (): CanComponentDeactivateResult
ngOnInit () {
this.serverService.getVideoPrivacies()
.subscribe(
privacies => {
- const { videoPrivacies, defaultPrivacyId } = this.videoService.explainedPrivacyLabels(privacies)
+ const defaultPrivacy = this.serverConfig.defaults.publish.privacy
+
+ const { videoPrivacies, defaultPrivacyId } = this.videoService.explainedPrivacyLabels(privacies, defaultPrivacy)
this.videoPrivacies = videoPrivacies
this.firstStepPrivacyId = defaultPrivacyId
- })
- }
-
- checkForm () {
- this.forceCheck()
- return this.form.valid
+ this.highestPrivacy = this.videoService.getHighestAvailablePrivacy(privacies)
+ })
}
protected updateVideoAndCaptions (video: VideoEdit) {
})
)
}
+
+ protected async isFormValid () {
+ await this.waitPendingCheck()
+ this.forceCheck()
+
+ return this.form.valid
+ }
}