From cb5ce4cb13095dbea6e5f05b96eaa42ffccf0716 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 29 Nov 2019 11:16:43 +0100 Subject: Add more filters to admin follows table --- server/models/utils.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'server/models/utils.ts') 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 return [ firstSort, lastSort ] } +function getFollowsSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] { + const { direction, field } = buildDirectionAndField(value) + + if (field === 'redundancyAllowed') { + return [ + [ 'ActorFollowing', 'Server', 'redundancyAllowed', direction ], + lastSort + ] + } + + return getSort(value, lastSort) +} + function isOutdated (model: { createdAt: Date, updatedAt: Date }, refreshInterval: number) { const now = Date.now() const createdAtTime = model.createdAt.getTime() @@ -163,6 +176,7 @@ export { buildWhereIdOrUUID, isOutdated, parseAggregateResult, + getFollowsSort, createSafeIn } -- cgit v1.2.3