aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-18 12:00:49 +0200
committerChocobozzz <me@florianbigard.com>2018-09-19 09:54:37 +0200
commit627621c1e8d37c33f7b3dd59f4c8907b12c630bc (patch)
tree007e7118f482c543d3898b222b62c185fda4fd2b /server/controllers
parente972e046dbe9b499944c4fab9220eee13e31ac1b (diff)
downloadPeerTube-627621c1e8d37c33f7b3dd59f4c8907b12c630bc.tar.gz
PeerTube-627621c1e8d37c33f7b3dd59f4c8907b12c630bc.tar.zst
PeerTube-627621c1e8d37c33f7b3dd59f4c8907b12c630bc.zip
Optimize SQL requests of watch page API endpoints
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/users/me.ts2
-rw-r--r--server/controllers/api/videos/comment.ts2
2 files changed, 2 insertions, 2 deletions
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index e886d4b2a..113563c39 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -293,7 +293,7 @@ async function getUserVideoQuotaUsed (req: express.Request, res: express.Respons
293} 293}
294 294
295async function getUserVideoRating (req: express.Request, res: express.Response, next: express.NextFunction) { 295async function getUserVideoRating (req: express.Request, res: express.Response, next: express.NextFunction) {
296 const videoId = +req.params.videoId 296 const videoId = res.locals.video.id
297 const accountId = +res.locals.oauth.token.User.Account.id 297 const accountId = +res.locals.oauth.token.User.Account.id
298 298
299 const ratingObj = await AccountVideoRateModel.load(accountId, videoId, null) 299 const ratingObj = await AccountVideoRateModel.load(accountId, videoId, null)
diff --git a/server/controllers/api/videos/comment.ts b/server/controllers/api/videos/comment.ts
index e35247829..8d0692b2b 100644
--- a/server/controllers/api/videos/comment.ts
+++ b/server/controllers/api/videos/comment.ts
@@ -86,7 +86,7 @@ async function listVideoThreadComments (req: express.Request, res: express.Respo
86 let resultList: ResultList<VideoCommentModel> 86 let resultList: ResultList<VideoCommentModel>
87 87
88 if (video.commentsEnabled === true) { 88 if (video.commentsEnabled === true) {
89 resultList = await VideoCommentModel.listThreadCommentsForApi(res.locals.video.id, res.locals.videoCommentThread.id) 89 resultList = await VideoCommentModel.listThreadCommentsForApi(video.id, res.locals.videoCommentThread.id)
90 } else { 90 } else {
91 resultList = { 91 resultList = {
92 total: 0, 92 total: 0,