Optimize SQL requests of watch page API endpoints
[oweals/peertube.git] / server / controllers / api / videos / comment.ts
index e35247829b249c7ae62899908b0373a31a8c6967..8d0692b2b051d54e8eb2741a536cd2f77c4871f7 100644 (file)
@@ -86,7 +86,7 @@ async function listVideoThreadComments (req: express.Request, res: express.Respo
   let resultList: ResultList<VideoCommentModel>
 
   if (video.commentsEnabled === true) {
-    resultList = await VideoCommentModel.listThreadCommentsForApi(res.locals.video.id, res.locals.videoCommentThread.id)
+    resultList = await VideoCommentModel.listThreadCommentsForApi(video.id, res.locals.videoCommentThread.id)
   } else {
     resultList = {
       total: 0,