diff options
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/validators/shared/video-comments.ts | 12 |
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 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { VideoCommentModel } from '@server/models/video/video-comment' | 2 | import { VideoCommentModel } from '@server/models/video/video-comment' |
3 | import { MVideoId } from '@server/types/models' | 3 | import { MVideoId } from '@server/types/models' |
4 | import { HttpStatusCode } from '@shared/models' | 4 | import { HttpStatusCode, ServerErrorCode } from '@shared/models' |
5 | 5 | ||
6 | async function doesVideoCommentThreadExist (idArg: number | string, video: MVideoId, res: express.Response) { | 6 | async 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 | ||