]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/utils.ts
Remove uneccessary details to link titles
[github/Chocobozzz/PeerTube.git] / server / models / utils.ts
index 7137419a2e3d34b2543befb5e5d7012e162c06e1..88c9b4adb94b43182d729af2c6c604947b1c7d09 100644 (file)
@@ -136,10 +136,7 @@ function createSimilarityAttribute (col: string, value: string) {
   )
 }
 
-function buildBlockedAccountSQL (serverAccountId: number, userAccountId?: number) {
-  const blockerIds = [ serverAccountId ]
-  if (userAccountId) blockerIds.push(userAccountId)
-
+function buildBlockedAccountSQL (blockerIds: number[]) {
   const blockerIdsString = blockerIds.join(', ')
 
   return 'SELECT "targetAccountId" AS "id" FROM "accountBlocklist" WHERE "accountId" IN (' + blockerIdsString + ')' +
@@ -207,14 +204,14 @@ function buildDirectionAndField (value: string) {
   return { direction, field }
 }
 
-function searchAttribute (sourceField, targetField) {
-  return sourceField
-    ? {
-      [targetField]: {
-        [Op.iLike]: `%${sourceField}%`
-      }
+function searchAttribute (sourceField?: string, targetField?: string) {
+  if (!sourceField) return {}
+
+  return {
+    [targetField]: {
+      [Op.iLike]: `%${sourceField}%`
     }
-    : {}
+  }
 }
 
 // ---------------------------------------------------------------------------