aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-07-29 10:32:56 +0200
committerChocobozzz <me@florianbigard.com>2022-07-29 10:32:56 +0200
commit5a9a56b78f6a62b3241f0dff1b8685001a3b3a1d (patch)
treec290f24a6b05dcb57387ad984b51de80f353c56f /server
parent37b1d97f226aa83f47cb27eae00f2d2821759457 (diff)
downloadPeerTube-5a9a56b78f6a62b3241f0dff1b8685001a3b3a1d.tar.gz
PeerTube-5a9a56b78f6a62b3241f0dff1b8685001a3b3a1d.tar.zst
PeerTube-5a9a56b78f6a62b3241f0dff1b8685001a3b3a1d.zip
Prevent error on highlighted thread
Diffstat (limited to 'server')
-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