aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/middlewares/abuses.ts
diff options
context:
space:
mode:
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// ---------------------------------------------------------------------------