From 82b9a1005cd5f5d3c338270839a24f217594b35d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 20 Jan 2022 10:52:50 +0100 Subject: [PATCH] Fix abuse crash on deleted reporter account --- .../shared/shared-abuse-list/abuse-list-table.component.ts | 1 + server/models/abuse/abuse-query-builder.ts | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts index 08cf297cc..8781c16f5 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts @@ -171,6 +171,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit { isLocalAbuse (abuse: AdminAbuse) { if (this.viewType === 'user') return true + if (!abuse.reporterAccount) return false return Actor.IS_LOCAL(abuse.reporterAccount.host) } diff --git a/server/models/abuse/abuse-query-builder.ts b/server/models/abuse/abuse-query-builder.ts index 532459144..025e6ba55 100644 --- a/server/models/abuse/abuse-query-builder.ts +++ b/server/models/abuse/abuse-query-builder.ts @@ -48,7 +48,10 @@ function buildAbuseListQuery (options: BuildAbusesQueryOptions, type: 'count' | ] 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) {