]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/custom-validators/video-abuses.ts
Translated using Weblate (Korean)
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / video-abuses.ts
index 290efb14970e0d8272fc16456c095f705b5e3b7b..5c7bc6fd93d771b2b4d0fad191f4cb2fae8ef1dd 100644 (file)
@@ -1,8 +1,6 @@
-import { Response } from 'express'
-import * as validator from 'validator'
-import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers'
+import validator from 'validator'
+import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers/constants'
 import { exists } from './misc'
-import { VideoAbuseModel } from '../../models/video/video-abuse'
 
 const VIDEO_ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_ABUSES
 
@@ -15,28 +13,12 @@ function isVideoAbuseModerationCommentValid (value: string) {
 }
 
 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
+  return exists(value) && VIDEO_ABUSE_STATES[value] !== undefined
 }
 
 // ---------------------------------------------------------------------------
 
 export {
-  isVideoAbuseExist,
   isVideoAbuseStateValid,
   isVideoAbuseReasonValid,
   isVideoAbuseModerationCommentValid