aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/sql/comment
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-01-10 09:16:33 +0100
committerChocobozzz <me@florianbigard.com>2023-01-10 09:17:23 +0100
commita8749f7c3b137f433e6944bb99fd721a6f0cfc1e (patch)
tree88046c0bfc69728f98dca7bcde4aa7e7d1308591 /server/models/video/sql/comment
parent57f255bebc2f55fd152c70b05b8de54e5e77da61 (diff)
downloadPeerTube-a8749f7c3b137f433e6944bb99fd721a6f0cfc1e.tar.gz
PeerTube-a8749f7c3b137f433e6944bb99fd721a6f0cfc1e.tar.zst
PeerTube-a8749f7c3b137f433e6944bb99fd721a6f0cfc1e.zip
Fix comments SQL pagination
Diffstat (limited to 'server/models/video/sql/comment')
-rw-r--r--server/models/video/sql/comment/video-comment-list-query-builder.ts11
-rw-r--r--server/models/video/sql/comment/video-comment-table-attributes.ts2
2 files changed, 2 insertions, 11 deletions
diff --git a/server/models/video/sql/comment/video-comment-list-query-builder.ts b/server/models/video/sql/comment/video-comment-list-query-builder.ts
index f3f6910e1..49b41b6d8 100644
--- a/server/models/video/sql/comment/video-comment-list-query-builder.ts
+++ b/server/models/video/sql/comment/video-comment-list-query-builder.ts
@@ -87,8 +87,7 @@ export class VideoCommentListQueryBuilder extends AbstractRunQuery {
87 this.query = `${this.select} ` + 87 this.query = `${this.select} ` +
88 `FROM (${this.innerQuery}) AS "VideoCommentModel" ` + 88 `FROM (${this.innerQuery}) AS "VideoCommentModel" ` +
89 `${this.joins} ` + 89 `${this.joins} ` +
90 `${this.getOrder()} ` + 90 `${this.getOrder()}`
91 `${this.getLimit()}`
92 } 91 }
93 92
94 private buildInnerListQuery () { 93 private buildInnerListQuery () {
@@ -375,14 +374,6 @@ export class VideoCommentListQueryBuilder extends AbstractRunQuery {
375 return 'ORDER BY ' + orders.map(o => `"${o[0]}" ${o[1]}`).join(', ') 374 return 'ORDER BY ' + orders.map(o => `"${o[0]}" ${o[1]}`).join(', ')
376 } 375 }
377 376
378 private getLimit () {
379 if (!this.options.count) return ''
380
381 this.replacements.limit = this.options.count
382
383 return `LIMIT :limit `
384 }
385
386 private getInnerLimit () { 377 private getInnerLimit () {
387 if (!this.options.count) return '' 378 if (!this.options.count) return ''
388 379
diff --git a/server/models/video/sql/comment/video-comment-table-attributes.ts b/server/models/video/sql/comment/video-comment-table-attributes.ts
index 10e635e41..87f8750c1 100644
--- a/server/models/video/sql/comment/video-comment-table-attributes.ts
+++ b/server/models/video/sql/comment/video-comment-table-attributes.ts
@@ -38,6 +38,6 @@ export class VideoCommentTableAttributes {
38 38
39 @Memoize() 39 @Memoize()
40 getAvatarAttributes () { 40 getAvatarAttributes () {
41 return ActorImageModel.getSQLAttributes('Account->Actor->Avatars', 'Account.Actor.Avatars.id').join(', ') 41 return ActorImageModel.getSQLAttributes('Account->Actor->Avatars', 'Account.Actor.Avatars.').join(', ')
42 } 42 }
43} 43}