1
0
Fork 0

Search on accepted follows only

This commit is contained in:
Chocobozzz 2025-03-04 10:58:09 +01:00
parent 54fdf42f2c
commit 888273a1d7
No known key found for this signature in database
GPG key ID: 583A612D890159BE

View file

@ -1,7 +1,8 @@
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'
import { forceNumber } from '@peertube/peertube-core-utils'
import { AttributesOnly } from '@peertube/peertube-typescript-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}'` +
')'
}