aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/validators/shared/video-comments.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/server/middlewares/validators/shared/video-comments.ts b/server/middlewares/validators/shared/video-comments.ts
index 386ae911f..8d1a16294 100644
--- a/server/middlewares/validators/shared/video-comments.ts
+++ b/server/middlewares/validators/shared/video-comments.ts
@@ -1,7 +1,7 @@
1import express from 'express' 1import express from 'express'
2import { VideoCommentModel } from '@server/models/video/video-comment' 2import { VideoCommentModel } from '@server/models/video/video-comment'
3import { MVideoId } from '@server/types/models' 3import { MVideoId } from '@server/types/models'
4import { HttpStatusCode } from '@shared/models' 4import { HttpStatusCode, ServerErrorCode } from '@shared/models'
5 5
6async function doesVideoCommentThreadExist (idArg: number | string, video: MVideoId, res: express.Response) { 6async function doesVideoCommentThreadExist (idArg: number | string, video: MVideoId, res: express.Response) {
7 const id = parseInt(idArg + '', 10) 7 const id = parseInt(idArg + '', 10)
@@ -16,7 +16,10 @@ async function doesVideoCommentThreadExist (idArg: number | string, video: MVide
16 } 16 }
17 17
18 if (videoComment.videoId !== video.id) { 18 if (videoComment.videoId !== video.id) {
19 res.fail({ message: 'Video comment is not associated to this video.' }) 19 res.fail({
20 type: ServerErrorCode.COMMENT_NOT_ASSOCIATED_TO_VIDEO,
21 message: 'Video comment is not associated to this video.'
22 })
20 return false 23 return false
21 } 24 }
22 25
@@ -42,7 +45,10 @@ async function doesVideoCommentExist (idArg: number | string, video: MVideoId, r
42 } 45 }
43 46
44 if (videoComment.videoId !== video.id) { 47 if (videoComment.videoId !== video.id) {
45 res.fail({ message: 'Video comment is not associated to this video.' }) 48 res.fail({
49 type: ServerErrorCode.COMMENT_NOT_ASSOCIATED_TO_VIDEO,
50 message: 'Video comment is not associated to this video.'
51 })
46 return false 52 return false
47 } 53 }
48 54