]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/shared/video-comments.ts
Merge branch 'release/4.3.0' into develop
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / shared / video-comments.ts
index 386ae911f25e31ac4f5ebd7906e91b4e7b56dcd6..8d1a162940dcb2c81ed8e2dd58e9befb24796316 100644 (file)
@@ -1,7 +1,7 @@
 import express from 'express'
 import { VideoCommentModel } from '@server/models/video/video-comment'
 import { MVideoId } from '@server/types/models'
-import { HttpStatusCode } from '@shared/models'
+import { HttpStatusCode, ServerErrorCode } from '@shared/models'
 
 async function doesVideoCommentThreadExist (idArg: number | string, video: MVideoId, res: express.Response) {
   const id = parseInt(idArg + '', 10)
@@ -16,7 +16,10 @@ async function doesVideoCommentThreadExist (idArg: number | string, video: MVide
   }
 
   if (videoComment.videoId !== video.id) {
-    res.fail({ message: 'Video comment is not associated to this video.' })
+    res.fail({
+      type: ServerErrorCode.COMMENT_NOT_ASSOCIATED_TO_VIDEO,
+      message: 'Video comment is not associated to this video.'
+    })
     return false
   }
 
@@ -42,7 +45,10 @@ async function doesVideoCommentExist (idArg: number | string, video: MVideoId, r
   }
 
   if (videoComment.videoId !== video.id) {
-    res.fail({ message: 'Video comment is not associated to this video.' })
+    res.fail({
+      type: ServerErrorCode.COMMENT_NOT_ASSOCIATED_TO_VIDEO,
+      message: 'Video comment is not associated to this video.'
+    })
     return false
   }