X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fabuse%2Fabuse-query-builder.ts;h=cfc924ba4b4c495a3d2d1ae08886d161e1d5856c;hb=714e33a7428b71ef98129ce85a4bd64140bcd912;hp=9d7cb75aa37cf75b8d7145fd632ceaa3c6272914;hpb=edbc9325462ddf4536775871ebc25e06f46612d1;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/abuse/abuse-query-builder.ts b/server/models/abuse/abuse-query-builder.ts index 9d7cb75aa..cfc924ba4 100644 --- a/server/models/abuse/abuse-query-builder.ts +++ b/server/models/abuse/abuse-query-builder.ts @@ -13,7 +13,7 @@ export type BuildAbusesQueryOptions = { searchReporter?: string searchReportee?: string - // video releated + // video related searchVideo?: string searchVideoChannel?: string videoIs?: AbuseVideoIs @@ -42,13 +42,16 @@ function buildAbuseListQuery (options: BuildAbusesQueryOptions, type: 'count' | 'LEFT JOIN "videoBlacklist" ON "videoBlacklist"."videoId" = "video"."id"', 'LEFT JOIN "videoChannel" ON "video"."channelId" = "videoChannel"."id"', 'LEFT JOIN "account" "reporterAccount" ON "reporterAccount"."id" = "abuse"."reporterAccountId"', - 'LEFT JOIN "account" "flaggedAccount" ON "flaggedAccount"."id" = "abuse"."reporterAccountId"', + 'LEFT JOIN "account" "flaggedAccount" ON "flaggedAccount"."id" = "abuse"."flaggedAccountId"', 'LEFT JOIN "commentAbuse" ON "commentAbuse"."abuseId" = "abuse"."id"', 'LEFT JOIN "videoComment" ON "commentAbuse"."videoCommentId" = "videoComment"."id"' ] if (options.serverAccountId || options.userAccountId) { - whereAnd.push('"abuse"."reporterAccountId" NOT IN (' + buildBlockedAccountSQL([ options.serverAccountId, options.userAccountId ]) + ')') + whereAnd.push( + '"abuse"."reporterAccountId" IS NULL OR ' + + '"abuse"."reporterAccountId" NOT IN (' + buildBlockedAccountSQL([ options.serverAccountId, options.userAccountId ]) + ')' + ) } if (options.reporterAccountId) {