X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Fshared%2Fvideo-comments.ts;h=8d1a162940dcb2c81ed8e2dd58e9befb24796316;hb=2f061e065ab43cc0b73595b619639a92952aeeba;hp=60132fb6e0bc45869452a6376f5efc1ec11d60b1;hpb=ac27887774e63d99f4e227fbe18846f143cc4b3c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/shared/video-comments.ts b/server/middlewares/validators/shared/video-comments.ts index 60132fb6e..8d1a16294 100644 --- a/server/middlewares/validators/shared/video-comments.ts +++ b/server/middlewares/validators/shared/video-comments.ts @@ -1,7 +1,7 @@ -import * as express from 'express' +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 }