aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/video-abuses.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-23 10:40:39 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commit3e753302d8c911b59971c16a8018df0e1ab78465 (patch)
treeefce7ece3273589228c5c948ea6757b2bdf65429 /server/helpers/custom-validators/video-abuses.ts
parenta8b666e9f1ed002230869606308749614390c82f (diff)
downloadPeerTube-3e753302d8c911b59971c16a8018df0e1ab78465.tar.gz
PeerTube-3e753302d8c911b59971c16a8018df0e1ab78465.tar.zst
PeerTube-3e753302d8c911b59971c16a8018df0e1ab78465.zip
Refactor middleware helpers
Diffstat (limited to 'server/helpers/custom-validators/video-abuses.ts')
-rw-r--r--server/helpers/custom-validators/video-abuses.ts16
1 files changed, 0 insertions, 16 deletions
diff --git a/server/helpers/custom-validators/video-abuses.ts b/server/helpers/custom-validators/video-abuses.ts
index a61dcee1c..e43d12be8 100644
--- a/server/helpers/custom-validators/video-abuses.ts
+++ b/server/helpers/custom-validators/video-abuses.ts
@@ -18,25 +18,9 @@ function isVideoAbuseStateValid (value: string) {
18 return exists(value) && VIDEO_ABUSE_STATES[ value ] !== undefined 18 return exists(value) && VIDEO_ABUSE_STATES[ value ] !== undefined
19} 19}
20 20
21async function doesVideoAbuseExist (abuseId: number, videoId: number, res: Response) {
22 const videoAbuse = await VideoAbuseModel.loadByIdAndVideoId(abuseId, videoId)
23
24 if (videoAbuse === null) {
25 res.status(404)
26 .json({ error: 'Video abuse not found' })
27 .end()
28
29 return false
30 }
31
32 res.locals.videoAbuse = videoAbuse
33 return true
34}
35
36// --------------------------------------------------------------------------- 21// ---------------------------------------------------------------------------
37 22
38export { 23export {
39 doesVideoAbuseExist,
40 isVideoAbuseStateValid, 24 isVideoAbuseStateValid,
41 isVideoAbuseReasonValid, 25 isVideoAbuseReasonValid,
42 isVideoAbuseModerationCommentValid 26 isVideoAbuseModerationCommentValid