diff options
author | Chocobozzz <me@florianbigard.com> | 2018-12-18 11:52:20 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-12-18 11:52:20 +0100 |
commit | afa4374ab4084ca95e33141d55a6449304caa665 (patch) | |
tree | f9da095a53644a0131250d8ae44ccd37ecfe293e /server/models | |
parent | 276d96529529621d5f70473990095495f2743c29 (diff) | |
download | PeerTube-afa4374ab4084ca95e33141d55a6449304caa665.tar.gz PeerTube-afa4374ab4084ca95e33141d55a6449304caa665.tar.zst PeerTube-afa4374ab4084ca95e33141d55a6449304caa665.zip |
Fix video sort
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/utils.ts | 6 |
1 files changed, 5 insertions, 1 deletions
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' ]) { | |||
29 | ] | 29 | ] |
30 | } | 30 | } |
31 | 31 | ||
32 | return [ field.split('.').concat([ direction ]), lastSort ] | 32 | const firstSort = typeof field === 'string' ? |
33 | field.split('.').concat([ direction ]) : | ||
34 | [ field, direction ] | ||
35 | |||
36 | return [ firstSort, lastSort ] | ||
33 | } | 37 | } |
34 | 38 | ||
35 | function getSortOnModel (model: any, value: string, lastSort: string[] = [ 'id', 'ASC' ]) { | 39 | function getSortOnModel (model: any, value: string, lastSort: string[] = [ 'id', 'ASC' ]) { |