aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/activitypub/actor-follow.ts28
1 files changed, 26 insertions, 2 deletions
diff --git a/server/models/activitypub/actor-follow.ts b/server/models/activitypub/actor-follow.ts
index 24272a40e..09bc6853d 100644
--- a/server/models/activitypub/actor-follow.ts
+++ b/server/models/activitypub/actor-follow.ts
@@ -292,12 +292,24 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
292 return ActorFollowModel.findAll(query) 292 return ActorFollowModel.findAll(query)
293 } 293 }
294 294
295 static listFollowingForApi (id: number, start: number, count: number, sort: string, search?: string) { 295 static listFollowingForApi (options: {
296 id: number,
297 start: number,
298 count: number,
299 sort: string,
300 state?: FollowState,
301 search?: string
302 }) {
303 const { id, start, count, sort, search, state } = options
304
305 const followWhere = state ? { state } : {}
306
296 const query = { 307 const query = {
297 distinct: true, 308 distinct: true,
298 offset: start, 309 offset: start,
299 limit: count, 310 limit: count,
300 order: getSort(sort), 311 order: getSort(sort),
312 where: followWhere,
301 include: [ 313 include: [
302 { 314 {
303 model: ActorModel, 315 model: ActorModel,
@@ -335,12 +347,24 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
335 }) 347 })
336 } 348 }
337 349
338 static listFollowersForApi (actorId: number, start: number, count: number, sort: string, search?: string) { 350 static listFollowersForApi (options: {
351 actorId: number,
352 start: number,
353 count: number,
354 sort: string,
355 state?: FollowState,
356 search?: string
357 }) {
358 const { actorId, start, count, sort, search, state } = options
359
360 const followWhere = state ? { state } : {}
361
339 const query = { 362 const query = {
340 distinct: true, 363 distinct: true,
341 offset: start, 364 offset: start,
342 limit: count, 365 limit: count,
343 order: getSort(sort), 366 order: getSort(sort),
367 where: followWhere,
344 include: [ 368 include: [
345 { 369 {
346 model: ActorModel, 370 model: ActorModel,