]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/utils.ts
Add originallyPublishedAt unit tests
[github/Chocobozzz/PeerTube.git] / server / models / utils.ts
index 50c865e758de9f5113a66a5f5554a83b55618d68..5b4093aec40d7b2aee217810c437da749b167afd 100644 (file)
@@ -29,7 +29,11 @@ function getVideoSort (value: string, lastSort: string[] = [ 'id', 'ASC' ]) {
     ]
   }
 
-  return [ [ field, 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' ]) {
@@ -72,8 +76,6 @@ function buildBlockedAccountSQL (serverAccountId: number, userAccountId?: number
 
   const query = 'SELECT "targetAccountId" AS "id" FROM "accountBlocklist" WHERE "accountId" IN (' + blockerIdsString + ')' +
     ' UNION ALL ' +
-    // 'SELECT "accountId" FROM "accountBlocklist" WHERE "targetAccountId" = user.account.id
-    // UNION ALL
     'SELECT "account"."id" AS "id" FROM account INNER JOIN "actor" ON account."actorId" = actor.id ' +
     'INNER JOIN "serverBlocklist" ON "actor"."serverId" = "serverBlocklist"."targetServerId" ' +
     'WHERE "serverBlocklist"."accountId" IN (' + blockerIdsString + ')'