]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/utils.ts
Don't call watching endpoint if history is disabled
[github/Chocobozzz/PeerTube.git] / server / models / utils.ts
index 6694eda690b0570b0cd450decf3fbef5490539be..5b4093aec40d7b2aee217810c437da749b167afd 100644 (file)
@@ -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' ]) {