aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/abuse/abuse-query-builder.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/abuse/abuse-query-builder.ts')
-rw-r--r--server/models/abuse/abuse-query-builder.ts15
1 files changed, 12 insertions, 3 deletions
diff --git a/server/models/abuse/abuse-query-builder.ts b/server/models/abuse/abuse-query-builder.ts
index 5fddcf3c4..9d7cb75aa 100644
--- a/server/models/abuse/abuse-query-builder.ts
+++ b/server/models/abuse/abuse-query-builder.ts
@@ -26,8 +26,10 @@ export type BuildAbusesQueryOptions = {
26 state?: AbuseState 26 state?: AbuseState
27 27
28 // accountIds 28 // accountIds
29 serverAccountId: number 29 serverAccountId?: number
30 userAccountId: number 30 userAccountId?: number
31
32 reporterAccountId?: number
31} 33}
32 34
33function buildAbuseListQuery (options: BuildAbusesQueryOptions, type: 'count' | 'id') { 35function buildAbuseListQuery (options: BuildAbusesQueryOptions, type: 'count' | 'id') {
@@ -45,7 +47,14 @@ function buildAbuseListQuery (options: BuildAbusesQueryOptions, type: 'count' |
45 'LEFT JOIN "videoComment" ON "commentAbuse"."videoCommentId" = "videoComment"."id"' 47 'LEFT JOIN "videoComment" ON "commentAbuse"."videoCommentId" = "videoComment"."id"'
46 ] 48 ]
47 49
48 whereAnd.push('"abuse"."reporterAccountId" NOT IN (' + buildBlockedAccountSQL([ options.serverAccountId, options.userAccountId ]) + ')') 50 if (options.serverAccountId || options.userAccountId) {
51 whereAnd.push('"abuse"."reporterAccountId" NOT IN (' + buildBlockedAccountSQL([ options.serverAccountId, options.userAccountId ]) + ')')
52 }
53
54 if (options.reporterAccountId) {
55 whereAnd.push('"abuse"."reporterAccountId" = :reporterAccountId')
56 replacements.reporterAccountId = options.reporterAccountId
57 }
49 58
50 if (options.search) { 59 if (options.search) {
51 const searchWhereOr = [ 60 const searchWhereOr = [