diff options
-rw-r--r-- | server/lib/moderation.ts | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/server/lib/moderation.ts b/server/lib/moderation.ts index 0ace2d021..5180b3299 100644 --- a/server/lib/moderation.ts +++ b/server/lib/moderation.ts | |||
@@ -28,6 +28,7 @@ import { VideoModel } from '../models/video/video' | |||
28 | import { VideoCommentModel } from '../models/video/video-comment' | 28 | import { VideoCommentModel } from '../models/video/video-comment' |
29 | import { sendAbuse } from './activitypub/send/send-flag' | 29 | import { sendAbuse } from './activitypub/send/send-flag' |
30 | import { Notifier } from './notifier' | 30 | import { Notifier } from './notifier' |
31 | import { afterCommitIfTransaction } from '@server/helpers/database-utils' | ||
31 | 32 | ||
32 | export type AcceptResult = { | 33 | export type AcceptResult = { |
33 | accepted: boolean | 34 | accepted: boolean |
@@ -225,10 +226,12 @@ async function createAbuse (options: { | |||
225 | const abuseJSON = abuseInstance.toFormattedAdminJSON() | 226 | const abuseJSON = abuseInstance.toFormattedAdminJSON() |
226 | auditLogger.create(reporterAccount.Actor.getIdentifier(), new AbuseAuditView(abuseJSON)) | 227 | auditLogger.create(reporterAccount.Actor.getIdentifier(), new AbuseAuditView(abuseJSON)) |
227 | 228 | ||
228 | Notifier.Instance.notifyOnNewAbuse({ | 229 | afterCommitIfTransaction(transaction, () => { |
229 | abuse: abuseJSON, | 230 | Notifier.Instance.notifyOnNewAbuse({ |
230 | abuseInstance, | 231 | abuse: abuseJSON, |
231 | reporter: reporterAccount.Actor.getIdentifier() | 232 | abuseInstance, |
233 | reporter: reporterAccount.Actor.getIdentifier() | ||
234 | }) | ||
232 | }) | 235 | }) |
233 | 236 | ||
234 | logger.info('Abuse report %d created.', abuseInstance.id) | 237 | logger.info('Abuse report %d created.', abuseInstance.id) |