Add more filters to admin follows table

This commit is contained in:
Chocobozzz 2019-11-29 11:16:43 +01:00
parent 97ecddae10
commit cb5ce4cb13
No known key found for this signature in database
GPG key ID: 583A612D890159BE
5 changed files with 23 additions and 13 deletions

View file

@ -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
}