aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/middlewares/abuses.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-07-07 10:57:04 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-07-10 14:02:41 +0200
commit57f6896f67cfc570cf3605dd94b0778101b2d9b9 (patch)
treeb82d879c46868ce75ff76c3e4d4eed590a87f6c4 /server/helpers/middlewares/abuses.ts
parentd95d15598847c7f020aa056e7e6e0c02d2bbf732 (diff)
downloadPeerTube-57f6896f67cfc570cf3605dd94b0778101b2d9b9.tar.gz
PeerTube-57f6896f67cfc570cf3605dd94b0778101b2d9b9.tar.zst
PeerTube-57f6896f67cfc570cf3605dd94b0778101b2d9b9.zip
Implement abuses check params
Diffstat (limited to 'server/helpers/middlewares/abuses.ts')
-rw-r--r--server/helpers/middlewares/abuses.ts13
1 files changed, 11 insertions, 2 deletions
diff --git a/server/helpers/middlewares/abuses.ts b/server/helpers/middlewares/abuses.ts
index 3906f6760..b102273a2 100644
--- a/server/helpers/middlewares/abuses.ts
+++ b/server/helpers/middlewares/abuses.ts
@@ -17,7 +17,6 @@ async function doesVideoAbuseExist (abuseIdArg: number | string, videoUUID: stri
17 if (abuse === null) { 17 if (abuse === null) {
18 res.status(404) 18 res.status(404)
19 .json({ error: 'Video abuse not found' }) 19 .json({ error: 'Video abuse not found' })
20 .end()
21 20
22 return false 21 return false
23 } 22 }
@@ -26,8 +25,18 @@ async function doesVideoAbuseExist (abuseIdArg: number | string, videoUUID: stri
26 return true 25 return true
27} 26}
28 27
29async function doesAbuseExist (abuseIdArg: number | string, videoUUID: string, res: Response) { 28async function doesAbuseExist (abuseId: number | string, res: Response) {
29 const abuse = await AbuseModel.loadById(parseInt(abuseId + '', 10))
30 30
31 if (!abuse) {
32 res.status(404)
33 .json({ error: 'Video abuse not found' })
34
35 return false
36 }
37
38 res.locals.abuse = abuse
39 return true
31} 40}
32 41
33// --------------------------------------------------------------------------- 42// ---------------------------------------------------------------------------