X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fcustom-validators%2Fvideo-abuses.ts;h=e43d12be8b9bdae01896dbba6a26d5cbdf206582;hb=d5c8932a601c1854db0a2e399ccaf26e17385f1a;hp=290efb14970e0d8272fc16456c095f705b5e3b7b;hpb=268eebed921ac13a9ce0f4717f4923aa24190657;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/custom-validators/video-abuses.ts b/server/helpers/custom-validators/video-abuses.ts index 290efb149..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 isVideoAbuseExist (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 { - isVideoAbuseExist, isVideoAbuseStateValid, isVideoAbuseReasonValid, isVideoAbuseModerationCommentValid