X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo-query-builder.ts;h=155afe64be00ce66bbc7db1f4a5c51ba0c3d6224;hb=9a320a06b663a2e02c3156a07135f75f9e987b11;hp=96df0a7f81ea77519f2905c368c18413675a81e1;hpb=5a22296bdb0e82e6318c46335248eee49fb90e11;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video-query-builder.ts b/server/models/video/video-query-builder.ts index 96df0a7f8..155afe64b 100644 --- a/server/models/video/video-query-builder.ts +++ b/server/models/video/video-query-builder.ts @@ -16,9 +16,11 @@ export type BuildVideosQueryOptions = { start: number sort: string + nsfw?: boolean filter?: VideoFilter + isLive?: boolean + categoryOneOf?: number[] - nsfw?: boolean licenceOneOf?: number[] languageOneOf?: string[] tagsOneOf?: string[] @@ -199,10 +201,14 @@ function buildListQuery (model: typeof Model, options: BuildVideosQueryOptions) if (options.nsfw === true) { and.push('"video"."nsfw" IS TRUE') + } else if (options.nsfw === false) { + and.push('"video"."nsfw" IS FALSE') } - if (options.nsfw === false) { - and.push('"video"."nsfw" IS FALSE') + if (options.isLive === true) { + and.push('"video"."isLive" IS TRUE') + } else if (options.isLive === false) { + and.push('"video"."isLive" IS FALSE') } if (options.categoryOneOf) { @@ -490,12 +496,13 @@ function wrapForAPIResults (baseQuery: string, replacements: any, options: Build 'INNER JOIN "actor" AS "VideoChannel->Account->Actor" ON "VideoChannel->Account"."actorId" = "VideoChannel->Account->Actor"."id"', 'LEFT OUTER JOIN "server" AS "VideoChannel->Actor->Server" ON "VideoChannel->Actor"."serverId" = "VideoChannel->Actor->Server"."id"', - 'LEFT OUTER JOIN "avatar" AS "VideoChannel->Actor->Avatar" ON "VideoChannel->Actor"."avatarId" = "VideoChannel->Actor->Avatar"."id"', + 'LEFT OUTER JOIN "actorImage" AS "VideoChannel->Actor->Avatar" ' + + 'ON "VideoChannel->Actor"."avatarId" = "VideoChannel->Actor->Avatar"."id"', 'LEFT OUTER JOIN "server" AS "VideoChannel->Account->Actor->Server" ' + 'ON "VideoChannel->Account->Actor"."serverId" = "VideoChannel->Account->Actor->Server"."id"', - 'LEFT OUTER JOIN "avatar" AS "VideoChannel->Account->Actor->Avatar" ' + + 'LEFT OUTER JOIN "actorImage" AS "VideoChannel->Account->Actor->Avatar" ' + 'ON "VideoChannel->Account->Actor"."avatarId" = "VideoChannel->Account->Actor->Avatar"."id"', 'LEFT OUTER JOIN "thumbnail" AS "Thumbnails" ON "video"."id" = "Thumbnails"."videoId"'