From a2eba50b8eee6d13b46425af05ef24025a173801 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 4 Mar 2021 16:12:46 +0100 Subject: Fix moderation notification --- server/lib/moderation.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'server') 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' import { VideoCommentModel } from '../models/video/video-comment' import { sendAbuse } from './activitypub/send/send-flag' import { Notifier } from './notifier' +import { afterCommitIfTransaction } from '@server/helpers/database-utils' export type AcceptResult = { accepted: boolean @@ -225,10 +226,12 @@ async function createAbuse (options: { const abuseJSON = abuseInstance.toFormattedAdminJSON() auditLogger.create(reporterAccount.Actor.getIdentifier(), new AbuseAuditView(abuseJSON)) - Notifier.Instance.notifyOnNewAbuse({ - abuse: abuseJSON, - abuseInstance, - reporter: reporterAccount.Actor.getIdentifier() + afterCommitIfTransaction(transaction, () => { + Notifier.Instance.notifyOnNewAbuse({ + abuse: abuseJSON, + abuseInstance, + reporter: reporterAccount.Actor.getIdentifier() + }) }) logger.info('Abuse report %d created.', abuseInstance.id) -- cgit v1.2.3