Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Search on accepted follows only

Chocobozzz888273a1d72d
diff --git a/server/core/models/shared/sql.ts b/server/core/models/shared/sql.ts
index b38c8e752f..7520f5dce5 100644
--- a/server/core/models/shared/sql.ts
+++ b/server/core/models/shared/sql.ts
@@ -1,7 +1,8 @@
-import { literal, Model, ModelStatic } from 'sequelize'
-import { Literal } from 'sequelize/types/utils'
import { forceNumber } from '@peertube/peertube-core-utils'
+import { FollowState } from '@peertube/peertube-models'
import { AttributesOnly } from '@peertube/peertube-typescript-utils'
+import { literal, Model, ModelStatic } from 'sequelize'
+import { Literal } from 'sequelize/types/utils'
// FIXME: have to specify the result type to not break peertube typings generation
export function buildLocalAccountIdsIn (): Literal {
@@ -29,11 +30,12 @@ export function buildBlockedAccountSQL (blockerIds: number[]) {
export function buildServerIdsFollowedBy (actorId: any) {
const actorIdNumber = forceNumber(actorId)
+ const followState: FollowState = 'accepted'
return '(' +
'SELECT "actor"."serverId" FROM "actorFollow" ' +
'INNER JOIN "actor" ON actor.id = "actorFollow"."targetActorId" ' +
- 'WHERE "actorFollow"."actorId" = ' + actorIdNumber +
+ `WHERE "actorFollow"."actorId" = ${actorIdNumber} AND "actorFollow"."state" = '${followState}'` +
')'
}