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, 9 insertions, 13 deletions
diff --git a/server/models/actor/actor-follow.ts b/server/models/actor/actor-follow.ts
index fc1cc7499..d6a2387a5 100644
--- a/server/models/actor/actor-follow.ts
+++ b/server/models/actor/actor-follow.ts
@@ -143,7 +143,7 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo
143 * @deprecated Use `findOrCreateCustom` instead 143 * @deprecated Use `findOrCreateCustom` instead
144 */ 144 */
145 static findOrCreate (): any { 145 static findOrCreate (): any {
146 throw new Error('Should not be called') 146 throw new Error('Must not be called')
147 } 147 }
148 148
149 // findOrCreate has issues with actor follow hooks 149 // findOrCreate has issues with actor follow hooks
@@ -288,7 +288,7 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo
288 return ActorFollowModel.findOne(query) 288 return ActorFollowModel.findOne(query)
289 } 289 }
290 290
291 static listSubscribedIn (actorId: number, targets: { name: string, host?: string }[]): Promise<MActorFollowFollowingHost[]> { 291 static listSubscriptionsOf (actorId: number, targets: { name: string, host?: string }[]): Promise<MActorFollowFollowingHost[]> {
292 const whereTab = targets 292 const whereTab = targets
293 .map(t => { 293 .map(t => {
294 if (t.host) { 294 if (t.host) {
@@ -348,7 +348,7 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo
348 return ActorFollowModel.findAll(query) 348 return ActorFollowModel.findAll(query)
349 } 349 }
350 350
351 static listFollowingForApi (options: { 351 static listInstanceFollowingForApi (options: {
352 id: number 352 id: number
353 start: number 353 start: number
354 count: number 354 count: number
@@ -415,7 +415,7 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo
415 } 415 }
416 416
417 static listFollowersForApi (options: { 417 static listFollowersForApi (options: {
418 actorId: number 418 actorIds: number[]
419 start: number 419 start: number
420 count: number 420 count: number
421 sort: string 421 sort: string
@@ -423,7 +423,7 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo
423 actorType?: ActivityPubActorType 423 actorType?: ActivityPubActorType
424 search?: string 424 search?: string
425 }) { 425 }) {
426 const { actorId, start, count, sort, search, state, actorType } = options 426 const { actorIds, start, count, sort, search, state, actorType } = options
427 427
428 const followWhere = state ? { state } : {} 428 const followWhere = state ? { state } : {}
429 const followerWhere: WhereOptions = {} 429 const followerWhere: WhereOptions = {}
@@ -452,20 +452,16 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo
452 model: ActorModel, 452 model: ActorModel,
453 required: true, 453 required: true,
454 as: 'ActorFollower', 454 as: 'ActorFollower',
455 where: followerWhere, 455 where: followerWhere
456 include: [
457 {
458 model: ServerModel,
459 required: true
460 }
461 ]
462 }, 456 },
463 { 457 {
464 model: ActorModel, 458 model: ActorModel,
465 as: 'ActorFollowing', 459 as: 'ActorFollowing',
466 required: true, 460 required: true,
467 where: { 461 where: {
468 id: actorId 462 id: {
463 [Op.in]: actorIds
464 }
469 } 465 }
470 } 466 }
471 ] 467 ]