From 9567011bf01f36c7f796ac1e0f1fb12c71635e53 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 30 Oct 2017 10:16:27 +0100 Subject: Add lazy description on server --- server/helpers/custom-validators/remote/videos.ts | 4 ++-- server/helpers/custom-validators/videos.ts | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'server/helpers') diff --git a/server/helpers/custom-validators/remote/videos.ts b/server/helpers/custom-validators/remote/videos.ts index a9ca36fe8..e0ffba679 100644 --- a/server/helpers/custom-validators/remote/videos.ts +++ b/server/helpers/custom-validators/remote/videos.ts @@ -19,7 +19,7 @@ import { isRemoteVideoLicenceValid, isRemoteVideoLanguageValid, isVideoNSFWValid, - isVideoDescriptionValid, + isVideoTruncatedDescriptionValid, isVideoDurationValid, isVideoFileInfoHashValid, isVideoNameValid, @@ -112,7 +112,7 @@ function isCommonVideoAttributesValid (video: any) { isRemoteVideoLicenceValid(video.licence) && isRemoteVideoLanguageValid(video.language) && isVideoNSFWValid(video.nsfw) && - isVideoDescriptionValid(video.description) && + isVideoTruncatedDescriptionValid(video.truncatedDescription) && isVideoDurationValid(video.duration) && isVideoNameValid(video.name) && isVideoTagsValid(video.tags) && diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index 11b085b78..5b9102275 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts @@ -54,6 +54,10 @@ function isVideoNSFWValid (value: any) { return typeof value === 'boolean' || (typeof value === 'string' && validator.isBoolean(value)) } +function isVideoTruncatedDescriptionValid (value: string) { + return exists(value) && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.TRUNCATED_DESCRIPTION) +} + function isVideoDescriptionValid (value: string) { return exists(value) && validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.DESCRIPTION) } @@ -173,6 +177,7 @@ export { isVideoLicenceValid, isVideoLanguageValid, isVideoNSFWValid, + isVideoTruncatedDescriptionValid, isVideoDescriptionValid, isVideoDurationValid, isVideoFileInfoHashValid, -- cgit v1.2.3