aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/middlewares/video-abuses.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/middlewares/video-abuses.ts')
-rw-r--r--server/helpers/middlewares/video-abuses.ts32
1 files changed, 0 insertions, 32 deletions
diff --git a/server/helpers/middlewares/video-abuses.ts b/server/helpers/middlewares/video-abuses.ts
deleted file mode 100644
index 97a5724b6..000000000
--- a/server/helpers/middlewares/video-abuses.ts
+++ /dev/null
@@ -1,32 +0,0 @@
1import { Response } from 'express'
2import { VideoAbuseModel } from '../../models/video/video-abuse'
3import { fetchVideo } from '../video'
4
5async function doesVideoAbuseExist (abuseIdArg: number | string, videoUUID: string, res: Response) {
6 const abuseId = parseInt(abuseIdArg + '', 10)
7 let videoAbuse = await VideoAbuseModel.loadByIdAndVideoId(abuseId, null, videoUUID)
8
9 if (!videoAbuse) {
10 const userId = res.locals.oauth?.token.User.id
11 const video = await fetchVideo(videoUUID, 'all', userId)
12
13 if (video) videoAbuse = await VideoAbuseModel.loadByIdAndVideoId(abuseId, video.id)
14 }
15
16 if (videoAbuse === null) {
17 res.status(404)
18 .json({ error: 'Video abuse not found' })
19 .end()
20
21 return false
22 }
23
24 res.locals.videoAbuse = videoAbuse
25 return true
26}
27
28// ---------------------------------------------------------------------------
29
30export {
31 doesVideoAbuseExist
32}