import { ActorFollow } from '../../../shared/models/actors/follow.model'
import { logger } from '../../helpers/logger'
import { getServerActor } from '../../helpers/utils'
-import { ACTOR_FOLLOW_SCORE } from '../../initializers'
+import { ACTOR_FOLLOW_SCORE } from '../../initializers/constants'
import { FOLLOW_STATES } from '../../initializers/constants'
import { ServerModel } from '../server/server'
import { getSort } from '../utils'
})
}
- static listFollowersForApi (id: number, start: number, count: number, sort: string, search?: string) {
+ static listFollowersForApi (actorId: number, start: number, count: number, sort: string, search?: string) {
const query = {
distinct: true,
offset: start,
as: 'ActorFollowing',
required: true,
where: {
- id
+ id: actorId
}
}
]
})
}
- static listSubscriptionsForApi (id: number, start: number, count: number, sort: string) {
+ static listSubscriptionsForApi (actorId: number, start: number, count: number, sort: string) {
const query = {
attributes: [],
distinct: true,
limit: count,
order: getSort(sort),
where: {
- actorId: id
+ actorId: actorId
},
include: [
{
})
}
- static listAcceptedFollowerUrlsForApi (actorIds: number[], t: Sequelize.Transaction, start?: number, count?: number) {
+ static listAcceptedFollowerUrlsForAP (actorIds: number[], t: Sequelize.Transaction, start?: number, count?: number) {
return ActorFollowModel.createListAcceptedFollowForApiQuery('followers', actorIds, t, start, count)
}
static updateFollowScore (inboxUrl: string, value: number, t?: Sequelize.Transaction) {
const query = `UPDATE "actorFollow" SET "score" = LEAST("score" + ${value}, ${ACTOR_FOLLOW_SCORE.MAX}) ` +
'WHERE id IN (' +
- 'SELECT "actorFollow"."id" FROM "actorFollow" ' +
- 'INNER JOIN "actor" ON "actor"."id" = "actorFollow"."actorId" ' +
- `WHERE "actor"."inboxUrl" = '${inboxUrl}' OR "actor"."sharedInboxUrl" = '${inboxUrl}'` +
+ 'SELECT "actorFollow"."id" FROM "actorFollow" ' +
+ 'INNER JOIN "actor" ON "actor"."id" = "actorFollow"."actorId" ' +
+ `WHERE "actor"."inboxUrl" = '${inboxUrl}' OR "actor"."sharedInboxUrl" = '${inboxUrl}'` +
')'
const options = {