From 7ed1edbbe4ffbef28093e4f5630751cb652814e4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 17 Aug 2020 11:47:04 +0200 Subject: We don't need services anymore for validators --- .../shared/video-caption-add-modal.component.ts | 10 +++--- .../+video-edit/shared/video-edit.component.ts | 38 ++++++++++++++-------- .../comment/video-comment-add.component.ts | 6 ++-- 3 files changed, 33 insertions(+), 21 deletions(-) (limited to 'client/src/app/+videos') diff --git a/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts b/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts index a90d04ce8..e48d16527 100644 --- a/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts +++ b/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts @@ -1,6 +1,7 @@ import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' import { ServerService } from '@app/core' -import { FormReactive, FormValidatorService, VideoCaptionsValidatorsService } from '@app/shared/shared-forms' +import { VIDEO_CAPTION_FILE_VALIDATOR, VIDEO_CAPTION_LANGUAGE_VALIDATOR } from '@app/shared/form-validators/video-captions-validators' +import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' import { VideoCaptionEdit } from '@app/shared/shared-main' import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' import { ServerConfig, VideoConstant } from '@shared/models' @@ -27,8 +28,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni constructor ( protected formValidatorService: FormValidatorService, private modalService: NgbModal, - private serverService: ServerService, - private videoCaptionsValidatorsService: VideoCaptionsValidatorsService + private serverService: ServerService ) { super() } @@ -46,8 +46,8 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni .subscribe(languages => this.videoCaptionLanguages = languages) this.buildForm({ - language: this.videoCaptionsValidatorsService.VIDEO_CAPTION_LANGUAGE, - captionfile: this.videoCaptionsValidatorsService.VIDEO_CAPTION_FILE + language: VIDEO_CAPTION_LANGUAGE_VALIDATOR, + captionfile: VIDEO_CAPTION_FILE_VALIDATOR }) } diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts index 050b6d931..92d06aa12 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts @@ -4,7 +4,20 @@ import { Component, Input, NgZone, OnDestroy, OnInit, ViewChild } from '@angular import { FormArray, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms' import { ServerService } from '@app/core' import { removeElementFromArray } from '@app/helpers' -import { FormReactiveValidationMessages, FormValidatorService, SelectChannelItem, VideoValidatorsService } from '@app/shared/shared-forms' +import { + VIDEO_CATEGORY_VALIDATOR, + VIDEO_CHANNEL_VALIDATOR, + VIDEO_DESCRIPTION_VALIDATOR, + VIDEO_LANGUAGE_VALIDATOR, + VIDEO_LICENCE_VALIDATOR, + VIDEO_NAME_VALIDATOR, + VIDEO_ORIGINALLY_PUBLISHED_AT_VALIDATOR, + VIDEO_PRIVACY_VALIDATOR, + VIDEO_SCHEDULE_PUBLICATION_AT_VALIDATOR, + VIDEO_SUPPORT_VALIDATOR, + VIDEO_TAGS_ARRAY_VALIDATOR +} from '@app/shared/form-validators/video-validators' +import { FormReactiveValidationMessages, FormValidatorService, SelectChannelItem } from '@app/shared/shared-forms' import { InstanceService } from '@app/shared/shared-instance' import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-main' import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models' @@ -57,7 +70,6 @@ export class VideoEditComponent implements OnInit, OnDestroy { constructor ( private formValidatorService: FormValidatorService, - private videoValidatorsService: VideoValidatorsService, private videoService: VideoService, private serverService: ServerService, private instanceService: InstanceService, @@ -84,22 +96,22 @@ export class VideoEditComponent implements OnInit, OnDestroy { tags: [] } const obj: any = { - name: this.videoValidatorsService.VIDEO_NAME, - privacy: this.videoValidatorsService.VIDEO_PRIVACY, - channelId: this.videoValidatorsService.VIDEO_CHANNEL, + name: VIDEO_NAME_VALIDATOR, + privacy: VIDEO_PRIVACY_VALIDATOR, + channelId: VIDEO_CHANNEL_VALIDATOR, nsfw: null, commentsEnabled: null, downloadEnabled: null, waitTranscoding: null, - category: this.videoValidatorsService.VIDEO_CATEGORY, - licence: this.videoValidatorsService.VIDEO_LICENCE, - language: this.videoValidatorsService.VIDEO_LANGUAGE, - description: this.videoValidatorsService.VIDEO_DESCRIPTION, - tags: this.videoValidatorsService.VIDEO_TAGS_ARRAY, + category: VIDEO_CATEGORY_VALIDATOR, + licence: VIDEO_LICENCE_VALIDATOR, + language: VIDEO_LANGUAGE_VALIDATOR, + description: VIDEO_DESCRIPTION_VALIDATOR, + tags: VIDEO_TAGS_ARRAY_VALIDATOR, previewfile: null, - support: this.videoValidatorsService.VIDEO_SUPPORT, - schedulePublicationAt: this.videoValidatorsService.VIDEO_SCHEDULE_PUBLICATION_AT, - originallyPublishedAt: this.videoValidatorsService.VIDEO_ORIGINALLY_PUBLISHED_AT + support: VIDEO_SUPPORT_VALIDATOR, + schedulePublicationAt: VIDEO_SCHEDULE_PUBLICATION_AT_VALIDATOR, + originallyPublishedAt: VIDEO_ORIGINALLY_PUBLISHED_AT_VALIDATOR } this.formValidatorService.updateForm( diff --git a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts index fa20ec3b9..c1d0032cc 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts +++ b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts @@ -2,7 +2,8 @@ import { Observable } from 'rxjs' import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core' import { Router } from '@angular/router' import { Notifier, User } from '@app/core' -import { FormReactive, FormValidatorService, VideoCommentValidatorsService } from '@app/shared/shared-forms' +import { VIDEO_COMMENT_TEXT_VALIDATOR } from '@app/shared/form-validators/video-comment-validators' +import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' import { Video } from '@app/shared/shared-main' import { VideoComment, VideoCommentService } from '@app/shared/shared-video-comment' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' @@ -33,7 +34,6 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, constructor ( protected formValidatorService: FormValidatorService, - private videoCommentValidatorsService: VideoCommentValidatorsService, private notifier: Notifier, private videoCommentService: VideoCommentService, private modalService: NgbModal, @@ -50,7 +50,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, ngOnInit () { this.buildForm({ - text: this.videoCommentValidatorsService.VIDEO_COMMENT_TEXT + text: VIDEO_COMMENT_TEXT_VALIDATOR }) if (this.user) { -- cgit v1.2.3