From c883db6d038a8510205f5f13ef46fb5a1c9e8288 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 4 Dec 2019 11:48:12 +0100 Subject: Move deleted comment on new follow tests --- server/middlewares/validators/videos/video-comments.ts | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'server/middlewares/validators/videos/video-comments.ts') diff --git a/server/middlewares/validators/videos/video-comments.ts b/server/middlewares/validators/videos/video-comments.ts index 1d81eb5d8..eb07d9430 100644 --- a/server/middlewares/validators/videos/video-comments.ts +++ b/server/middlewares/validators/videos/video-comments.ts @@ -189,6 +189,13 @@ function isVideoCommentsEnabled (video: MVideo, res: express.Response) { } function checkUserCanDeleteVideoComment (user: MUser, videoComment: MCommentOwner, res: express.Response) { + if (videoComment.isDeleted()) { + res.status(409) + .json({ error: 'This comment is already deleted' }) + .end() + return false + } + const account = videoComment.Account if (user.hasRight(UserRight.REMOVE_ANY_VIDEO_COMMENT) === false && account.userId !== user.id) { res.status(403) -- cgit v1.2.3