diff options
author | Chocobozzz <me@florianbigard.com> | 2022-01-20 10:52:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-01-20 10:52:50 +0100 |
commit | 82b9a1005cd5f5d3c338270839a24f217594b35d (patch) | |
tree | ef3dbcff6a9024823b11b68cdb58e7cefc003d5c | |
parent | efd4ff5fbcd1e557c3c8af25b8b8ee5b3a2e9f0d (diff) | |
download | PeerTube-82b9a1005cd5f5d3c338270839a24f217594b35d.tar.gz PeerTube-82b9a1005cd5f5d3c338270839a24f217594b35d.tar.zst PeerTube-82b9a1005cd5f5d3c338270839a24f217594b35d.zip |
Fix abuse crash on deleted reporter account
-rw-r--r-- | client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts | 1 | ||||
-rw-r--r-- | server/models/abuse/abuse-query-builder.ts | 5 |
2 files changed, 5 insertions, 1 deletions
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 { | |||
171 | 171 | ||
172 | isLocalAbuse (abuse: AdminAbuse) { | 172 | isLocalAbuse (abuse: AdminAbuse) { |
173 | if (this.viewType === 'user') return true | 173 | if (this.viewType === 'user') return true |
174 | if (!abuse.reporterAccount) return false | ||
174 | 175 | ||
175 | return Actor.IS_LOCAL(abuse.reporterAccount.host) | 176 | return Actor.IS_LOCAL(abuse.reporterAccount.host) |
176 | } | 177 | } |
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' | | |||
48 | ] | 48 | ] |
49 | 49 | ||
50 | if (options.serverAccountId || options.userAccountId) { | 50 | if (options.serverAccountId || options.userAccountId) { |
51 | whereAnd.push('"abuse"."reporterAccountId" NOT IN (' + buildBlockedAccountSQL([ options.serverAccountId, options.userAccountId ]) + ')') | 51 | whereAnd.push( |
52 | '"abuse"."reporterAccountId" IS NULL OR ' + | ||
53 | '"abuse"."reporterAccountId" NOT IN (' + buildBlockedAccountSQL([ options.serverAccountId, options.userAccountId ]) + ')' | ||
54 | ) | ||
52 | } | 55 | } |
53 | 56 | ||
54 | if (options.reporterAccountId) { | 57 | if (options.reporterAccountId) { |