diff options
Diffstat (limited to 'server/models/utils.ts')
-rw-r--r-- | server/models/utils.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/server/models/utils.ts b/server/models/utils.ts index ccdbcd1cf..b53a52a05 100644 --- a/server/models/utils.ts +++ b/server/models/utils.ts | |||
@@ -58,6 +58,19 @@ function getBlacklistSort (model: any, value: string, lastSort: OrderItem = [ 'i | |||
58 | return [ firstSort, lastSort ] | 58 | return [ firstSort, lastSort ] |
59 | } | 59 | } |
60 | 60 | ||
61 | function getFollowsSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] { | ||
62 | const { direction, field } = buildDirectionAndField(value) | ||
63 | |||
64 | if (field === 'redundancyAllowed') { | ||
65 | return [ | ||
66 | [ 'ActorFollowing', 'Server', 'redundancyAllowed', direction ], | ||
67 | lastSort | ||
68 | ] | ||
69 | } | ||
70 | |||
71 | return getSort(value, lastSort) | ||
72 | } | ||
73 | |||
61 | function isOutdated (model: { createdAt: Date, updatedAt: Date }, refreshInterval: number) { | 74 | function isOutdated (model: { createdAt: Date, updatedAt: Date }, refreshInterval: number) { |
62 | const now = Date.now() | 75 | const now = Date.now() |
63 | const createdAtTime = model.createdAt.getTime() | 76 | const createdAtTime = model.createdAt.getTime() |
@@ -163,6 +176,7 @@ export { | |||
163 | buildWhereIdOrUUID, | 176 | buildWhereIdOrUUID, |
164 | isOutdated, | 177 | isOutdated, |
165 | parseAggregateResult, | 178 | parseAggregateResult, |
179 | getFollowsSort, | ||
166 | createSafeIn | 180 | createSafeIn |
167 | } | 181 | } |
168 | 182 | ||