From afa4374ab4084ca95e33141d55a6449304caa665 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 18 Dec 2018 11:52:20 +0100 Subject: Fix video sort --- server/models/utils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'server/models') diff --git a/server/models/utils.ts b/server/models/utils.ts index 6694eda69..5b4093aec 100644 --- a/server/models/utils.ts +++ b/server/models/utils.ts @@ -29,7 +29,11 @@ function getVideoSort (value: string, lastSort: string[] = [ 'id', 'ASC' ]) { ] } - return [ field.split('.').concat([ direction ]), lastSort ] + const firstSort = typeof field === 'string' ? + field.split('.').concat([ direction ]) : + [ field, direction ] + + return [ firstSort, lastSort ] } function getSortOnModel (model: any, value: string, lastSort: string[] = [ 'id', 'ASC' ]) { -- cgit v1.2.3