aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/activitypub
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-10-23 12:06:26 +0200
committerChocobozzz <me@florianbigard.com>2019-10-23 12:06:26 +0200
commit862ead21a3d268677977a25bdb6853003299cf71 (patch)
tree956130f9bc096cfbc50bec1c7d1f3bb96b5daa06 /server/models/activitypub
parent8ed11b89b8c9bde7bf831341d0cba0ab64f7ffd5 (diff)
downloadPeerTube-862ead21a3d268677977a25bdb6853003299cf71.tar.gz
PeerTube-862ead21a3d268677977a25bdb6853003299cf71.tar.zst
PeerTube-862ead21a3d268677977a25bdb6853003299cf71.zip
Fix and cleanup actor follow inbox sql query
Diffstat (limited to 'server/models/activitypub')
-rw-r--r--server/models/activitypub/actor-follow.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/server/models/activitypub/actor-follow.ts b/server/models/activitypub/actor-follow.ts
index fb3c4ef9d..24272a40e 100644
--- a/server/models/activitypub/actor-follow.ts
+++ b/server/models/activitypub/actor-follow.ts
@@ -574,8 +574,8 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
574 } 574 }
575 575
576 const selections: string[] = [] 576 const selections: string[] = []
577 if (distinct === true) selections.push('DISTINCT("Follows"."' + columnUrl + '") AS "selectionUrl"') 577 if (distinct === true) selections.push(`DISTINCT("Follows"."${columnUrl}") AS "selectionUrl"`)
578 else selections.push('"Follows"."' + columnUrl + '" AS "selectionUrl"') 578 else selections.push(`"Follows"."${columnUrl}" AS "selectionUrl"`)
579 579
580 selections.push('COUNT(*) AS "total"') 580 selections.push('COUNT(*) AS "total"')
581 581
@@ -585,7 +585,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
585 let query = 'SELECT ' + selection + ' FROM "actor" ' + 585 let query = 'SELECT ' + selection + ' FROM "actor" ' +
586 'INNER JOIN "actorFollow" ON "actorFollow"."' + firstJoin + '" = "actor"."id" ' + 586 'INNER JOIN "actorFollow" ON "actorFollow"."' + firstJoin + '" = "actor"."id" ' +
587 'INNER JOIN "actor" AS "Follows" ON "actorFollow"."' + secondJoin + '" = "Follows"."id" ' + 587 'INNER JOIN "actor" AS "Follows" ON "actorFollow"."' + secondJoin + '" = "Follows"."id" ' +
588 'WHERE "actor"."id" = ANY ($actorIds) AND "actorFollow"."state" = \'accepted\' AND "selectionUrl" IS NOT NULL ' 588 `WHERE "actor"."id" = ANY ($actorIds) AND "actorFollow"."state" = 'accepted' AND "Follows"."${columnUrl}" IS NOT NULL `
589 589
590 if (count !== undefined) query += 'LIMIT ' + count 590 if (count !== undefined) query += 'LIMIT ' + count
591 if (start !== undefined) query += ' OFFSET ' + start 591 if (start !== undefined) query += ' OFFSET ' + start