]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/videos/comment.ts
Guess if we need to generate the thumbnail for imports
[github/Chocobozzz/PeerTube.git] / server / controllers / api / videos / comment.ts
index ccd76c0933cef487940d8764e0cfa97aa8e6e1f7..752a335968a43aec232f985998d336d7a57a0781 100644 (file)
@@ -29,6 +29,7 @@ import {
 } from '../../../middlewares/validators'
 import { AccountModel } from '../../../models/account/account'
 import { VideoCommentModel } from '../../../models/video/video-comment'
+import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
 
 const auditLogger = auditLoggerFactory('comments')
 const videoCommentRouter = express.Router()
@@ -160,6 +161,10 @@ async function listVideoThreadComments (req: express.Request, res: express.Respo
     }
   }
 
+  if (resultList.data.length === 0) {
+    return res.sendStatus(HttpStatusCode.NOT_FOUND_404)
+  }
+
   return res.json(buildFormattedCommentTree(resultList))
 }
 
@@ -214,5 +219,7 @@ async function removeVideoComment (req: express.Request, res: express.Response)
 
   auditLogger.delete(getAuditIdFromRes(res), new CommentAuditView(videoCommentInstance.toFormattedJSON()))
 
-  return res.type('json').status(204).end()
+  return res.type('json')
+            .status(HttpStatusCode.NO_CONTENT_204)
+            .end()
 }