X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fcustom-validators%2Fvideo-abuses.ts;h=e43d12be8b9bdae01896dbba6a26d5cbdf206582;hb=d5c8932a601c1854db0a2e399ccaf26e17385f1a;hp=71500fde5b91a29f100be304a32eedfd18325043;hpb=0f6acda11681de90d38dd18669863c6e270851ee;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/custom-validators/video-abuses.ts b/server/helpers/custom-validators/video-abuses.ts index 71500fde5..e43d12be8 100644 --- a/server/helpers/custom-validators/video-abuses.ts +++ b/server/helpers/custom-validators/video-abuses.ts @@ -1,6 +1,6 @@ import { Response } from 'express' import * as validator from 'validator' -import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers' +import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers/constants' import { exists } from './misc' import { VideoAbuseModel } from '../../models/video/video-abuse' @@ -18,25 +18,9 @@ function isVideoAbuseStateValid (value: string) { return exists(value) && VIDEO_ABUSE_STATES[ value ] !== undefined } -async function doesVideoAbuseExist (abuseId: number, videoId: number, res: Response) { - const videoAbuse = await VideoAbuseModel.loadByIdAndVideoId(abuseId, videoId) - - if (videoAbuse === null) { - res.status(404) - .json({ error: 'Video abuse not found' }) - .end() - - return false - } - - res.locals.videoAbuse = videoAbuse - return true -} - // --------------------------------------------------------------------------- export { - doesVideoAbuseExist, isVideoAbuseStateValid, isVideoAbuseReasonValid, isVideoAbuseModerationCommentValid