aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/actor/actor-follow.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/actor/actor-follow.ts')
-rw-r--r--server/models/actor/actor-follow.ts22
1 files changed, 6 insertions, 16 deletions
diff --git a/server/models/actor/actor-follow.ts b/server/models/actor/actor-follow.ts
index 32e5d78b0..0f199d208 100644
--- a/server/models/actor/actor-follow.ts
+++ b/server/models/actor/actor-follow.ts
@@ -37,8 +37,8 @@ import { logger } from '../../helpers/logger'
37import { ACTOR_FOLLOW_SCORE, CONSTRAINTS_FIELDS, FOLLOW_STATES, SERVER_ACTOR_NAME, SORTABLE_COLUMNS } from '../../initializers/constants' 37import { ACTOR_FOLLOW_SCORE, CONSTRAINTS_FIELDS, FOLLOW_STATES, SERVER_ACTOR_NAME, SORTABLE_COLUMNS } from '../../initializers/constants'
38import { AccountModel } from '../account/account' 38import { AccountModel } from '../account/account'
39import { ServerModel } from '../server/server' 39import { ServerModel } from '../server/server'
40import { doesExist } from '../shared/query'
41import { buildSQLAttributes, createSafeIn, getSort, searchAttribute, throwIfNotValid } from '../shared' 40import { buildSQLAttributes, createSafeIn, getSort, searchAttribute, throwIfNotValid } from '../shared'
41import { doesExist } from '../shared/query'
42import { VideoChannelModel } from '../video/video-channel' 42import { VideoChannelModel } from '../video/video-channel'
43import { ActorModel, unusedActorAttributesForAPI } from './actor' 43import { ActorModel, unusedActorAttributesForAPI } from './actor'
44import { InstanceListFollowersQueryBuilder, ListFollowersOptions } from './sql/instance-list-followers-query-builder' 44import { InstanceListFollowersQueryBuilder, ListFollowersOptions } from './sql/instance-list-followers-query-builder'
@@ -265,9 +265,7 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo
265 model: ActorModel, 265 model: ActorModel,
266 required: true, 266 required: true,
267 as: 'ActorFollowing', 267 as: 'ActorFollowing',
268 where: { 268 where: ActorModel.wherePreferredUsername(targetName),
269 preferredUsername: targetName
270 },
271 include: [ 269 include: [
272 { 270 {
273 model: VideoChannelModel.unscoped(), 271 model: VideoChannelModel.unscoped(),
@@ -313,24 +311,16 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo
313 if (t.host) { 311 if (t.host) {
314 return { 312 return {
315 [Op.and]: [ 313 [Op.and]: [
316 { 314 ActorModel.wherePreferredUsername(t.name, '$preferredUsername$'),
317 $preferredUsername$: t.name 315 { $host$: t.host }
318 },
319 {
320 $host$: t.host
321 }
322 ] 316 ]
323 } 317 }
324 } 318 }
325 319
326 return { 320 return {
327 [Op.and]: [ 321 [Op.and]: [
328 { 322 ActorModel.wherePreferredUsername(t.name, '$preferredUsername$'),
329 $preferredUsername$: t.name 323 { $serverId$: null }
330 },
331 {
332 $serverId$: null
333 }
334 ] 324 ]
335 } 325 }
336 }) 326 })