Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix video sort

Chocobozzzafa4374ab408
diff --git a/server/models/utils.ts b/server/models/utils.ts
index 6694eda690..5b4093aec4 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' ]) {