diff options
Diffstat (limited to 'server/models/account')
-rw-r--r-- | server/models/account/account.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/server/models/account/account.ts b/server/models/account/account.ts index 665ecd595..37194a119 100644 --- a/server/models/account/account.ts +++ b/server/models/account/account.ts | |||
@@ -52,6 +52,7 @@ export enum ScopeNames { | |||
52 | export type SummaryOptions = { | 52 | export type SummaryOptions = { |
53 | actorRequired?: boolean // Default: true | 53 | actorRequired?: boolean // Default: true |
54 | whereActor?: WhereOptions | 54 | whereActor?: WhereOptions |
55 | whereServer?: WhereOptions | ||
55 | withAccountBlockerIds?: number[] | 56 | withAccountBlockerIds?: number[] |
56 | } | 57 | } |
57 | 58 | ||
@@ -65,12 +66,11 @@ export type SummaryOptions = { | |||
65 | })) | 66 | })) |
66 | @Scopes(() => ({ | 67 | @Scopes(() => ({ |
67 | [ScopeNames.SUMMARY]: (options: SummaryOptions = {}) => { | 68 | [ScopeNames.SUMMARY]: (options: SummaryOptions = {}) => { |
68 | const whereActor = options.whereActor || undefined | ||
69 | |||
70 | const serverInclude: IncludeOptions = { | 69 | const serverInclude: IncludeOptions = { |
71 | attributes: [ 'host' ], | 70 | attributes: [ 'host' ], |
72 | model: ServerModel.unscoped(), | 71 | model: ServerModel.unscoped(), |
73 | required: false | 72 | required: !!options.whereServer, |
73 | where: options.whereServer | ||
74 | } | 74 | } |
75 | 75 | ||
76 | const queryInclude: Includeable[] = [ | 76 | const queryInclude: Includeable[] = [ |
@@ -78,7 +78,7 @@ export type SummaryOptions = { | |||
78 | attributes: [ 'id', 'preferredUsername', 'url', 'serverId', 'avatarId' ], | 78 | attributes: [ 'id', 'preferredUsername', 'url', 'serverId', 'avatarId' ], |
79 | model: ActorModel.unscoped(), | 79 | model: ActorModel.unscoped(), |
80 | required: options.actorRequired ?? true, | 80 | required: options.actorRequired ?? true, |
81 | where: whereActor, | 81 | where: options.whereActor, |
82 | include: [ | 82 | include: [ |
83 | serverInclude, | 83 | serverInclude, |
84 | 84 | ||