diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-06 14:58:01 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-08-07 08:28:14 +0200 |
commit | bd45d503e5d007e730f4e81dccd7e7864c9a85cc (patch) | |
tree | b78df768b8253ba401232c17da940cea016c9960 /server/helpers/custom-validators | |
parent | 583eb04b541175035d6d452ca626a96ebf2b7437 (diff) | |
download | PeerTube-bd45d503e5d007e730f4e81dccd7e7864c9a85cc.tar.gz PeerTube-bd45d503e5d007e730f4e81dccd7e7864c9a85cc.tar.zst PeerTube-bd45d503e5d007e730f4e81dccd7e7864c9a85cc.zip |
Reorganize shared models
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r-- | server/helpers/custom-validators/abuses.ts | 3 | ||||
-rw-r--r-- | server/helpers/custom-validators/plugins.ts | 3 | ||||
-rw-r--r-- | server/helpers/custom-validators/video-blacklist.ts | 3 |
3 files changed, 6 insertions, 3 deletions
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 @@ | |||
1 | import validator from 'validator' | 1 | import validator from 'validator' |
2 | import { AbuseFilter, abusePredefinedReasonsMap, AbusePredefinedReasonsString, AbuseVideoIs, AbuseCreate } from '@shared/models' | 2 | import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse' |
3 | import { AbuseCreate, AbuseFilter, AbusePredefinedReasonsString, AbuseVideoIs } from '@shared/models' | ||
3 | import { ABUSE_STATES, CONSTRAINTS_FIELDS } from '../../initializers/constants' | 4 | import { ABUSE_STATES, CONSTRAINTS_FIELDS } from '../../initializers/constants' |
4 | import { exists, isArray } from './misc' | 5 | import { exists, isArray } from './misc' |
5 | 6 | ||
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' | |||
8 | const PLUGINS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.PLUGINS | 8 | const PLUGINS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.PLUGINS |
9 | 9 | ||
10 | function isPluginTypeValid (value: any) { | 10 | function isPluginTypeValid (value: any) { |
11 | return exists(value) && validator.isInt('' + value) && PluginType[value] !== undefined | 11 | return exists(value) && |
12 | (value === PluginType.PLUGIN || value === PluginType.THEME) | ||
12 | } | 13 | } |
13 | 14 | ||
14 | function isPluginNameValid (value: string) { | 15 | 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) { | |||
10 | } | 10 | } |
11 | 11 | ||
12 | function isVideoBlacklistTypeValid (value: any) { | 12 | function isVideoBlacklistTypeValid (value: any) { |
13 | return exists(value) && validator.isInt('' + value) && VideoBlacklistType[value] !== undefined | 13 | return exists(value) && |
14 | (value === VideoBlacklistType.AUTO_BEFORE_PUBLISHED || value === VideoBlacklistType.MANUAL) | ||
14 | } | 15 | } |
15 | 16 | ||
16 | // --------------------------------------------------------------------------- | 17 | // --------------------------------------------------------------------------- |