From bd45d503e5d007e730f4e81dccd7e7864c9a85cc Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 6 Aug 2020 14:58:01 +0200 Subject: Reorganize shared models --- server/helpers/custom-validators/abuses.ts | 3 ++- server/helpers/custom-validators/plugins.ts | 3 ++- server/helpers/custom-validators/video-blacklist.ts | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'server/helpers') diff --git a/server/helpers/custom-validators/abuses.ts b/server/helpers/custom-validators/abuses.ts index 0ddde4b06..94719641a 100644 --- a/server/helpers/custom-validators/abuses.ts +++ b/server/helpers/custom-validators/abuses.ts @@ -1,5 +1,6 @@ import validator from 'validator' -import { AbuseFilter, abusePredefinedReasonsMap, AbusePredefinedReasonsString, AbuseVideoIs, AbuseCreate } from '@shared/models' +import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse' +import { AbuseCreate, AbuseFilter, AbusePredefinedReasonsString, AbuseVideoIs } from '@shared/models' import { ABUSE_STATES, CONSTRAINTS_FIELDS } from '../../initializers/constants' import { exists, isArray } from './misc' diff --git a/server/helpers/custom-validators/plugins.ts b/server/helpers/custom-validators/plugins.ts index d2fc03936..f2d4efb32 100644 --- a/server/helpers/custom-validators/plugins.ts +++ b/server/helpers/custom-validators/plugins.ts @@ -8,7 +8,8 @@ import { isUrlValid } from './activitypub/misc' const PLUGINS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.PLUGINS function isPluginTypeValid (value: any) { - return exists(value) && validator.isInt('' + value) && PluginType[value] !== undefined + return exists(value) && + (value === PluginType.PLUGIN || value === PluginType.THEME) } function isPluginNameValid (value: string) { diff --git a/server/helpers/custom-validators/video-blacklist.ts b/server/helpers/custom-validators/video-blacklist.ts index 17cb3b00b..34fcec38e 100644 --- a/server/helpers/custom-validators/video-blacklist.ts +++ b/server/helpers/custom-validators/video-blacklist.ts @@ -10,7 +10,8 @@ function isVideoBlacklistReasonValid (value: string) { } function isVideoBlacklistTypeValid (value: any) { - return exists(value) && validator.isInt('' + value) && VideoBlacklistType[value] !== undefined + return exists(value) && + (value === VideoBlacklistType.AUTO_BEFORE_PUBLISHED || value === VideoBlacklistType.MANUAL) } // --------------------------------------------------------------------------- -- cgit v1.2.3