aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/moderation.ts11
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'
28import { VideoCommentModel } from '../models/video/video-comment' 28import { VideoCommentModel } from '../models/video/video-comment'
29import { sendAbuse } from './activitypub/send/send-flag' 29import { sendAbuse } from './activitypub/send/send-flag'
30import { Notifier } from './notifier' 30import { Notifier } from './notifier'
31import { afterCommitIfTransaction } from '@server/helpers/database-utils'
31 32
32export type AcceptResult = { 33export 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)