aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-12-18 11:52:20 +0100
committerChocobozzz <me@florianbigard.com>2018-12-18 11:52:20 +0100
commitafa4374ab4084ca95e33141d55a6449304caa665 (patch)
treef9da095a53644a0131250d8ae44ccd37ecfe293e
parent276d96529529621d5f70473990095495f2743c29 (diff)
downloadPeerTube-afa4374ab4084ca95e33141d55a6449304caa665.tar.gz
PeerTube-afa4374ab4084ca95e33141d55a6449304caa665.tar.zst
PeerTube-afa4374ab4084ca95e33141d55a6449304caa665.zip
Fix video sort
-rw-r--r--server/models/utils.ts6
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
35function getSortOnModel (model: any, value: string, lastSort: string[] = [ 'id', 'ASC' ]) { 39function getSortOnModel (model: any, value: string, lastSort: string[] = [ 'id', 'ASC' ]) {