mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 18:29:27 +02:00
Search on accepted follows only
This commit is contained in:
parent
54fdf42f2c
commit
888273a1d7
1 changed files with 5 additions and 3 deletions
|
@ -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, Model, ModelStatic } from 'sequelize'
|
||||||
import { Literal } from 'sequelize/types/utils'
|
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
|
// FIXME: have to specify the result type to not break peertube typings generation
|
||||||
export function buildLocalAccountIdsIn (): Literal {
|
export function buildLocalAccountIdsIn (): Literal {
|
||||||
|
@ -29,11 +30,12 @@ export function buildBlockedAccountSQL (blockerIds: number[]) {
|
||||||
|
|
||||||
export function buildServerIdsFollowedBy (actorId: any) {
|
export function buildServerIdsFollowedBy (actorId: any) {
|
||||||
const actorIdNumber = forceNumber(actorId)
|
const actorIdNumber = forceNumber(actorId)
|
||||||
|
const followState: FollowState = 'accepted'
|
||||||
|
|
||||||
return '(' +
|
return '(' +
|
||||||
'SELECT "actor"."serverId" FROM "actorFollow" ' +
|
'SELECT "actor"."serverId" FROM "actorFollow" ' +
|
||||||
'INNER JOIN "actor" ON actor.id = "actorFollow"."targetActorId" ' +
|
'INNER JOIN "actor" ON actor.id = "actorFollow"."targetActorId" ' +
|
||||||
'WHERE "actorFollow"."actorId" = ' + actorIdNumber +
|
`WHERE "actorFollow"."actorId" = ${actorIdNumber} AND "actorFollow"."state" = '${followState}'` +
|
||||||
')'
|
')'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue