Fix moderation notification

pull/3840/head
Chocobozzz 2021-03-04 16:12:46 +01:00
parent 8726cd4941
commit a2eba50b8e
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 7 additions and 4 deletions

View File

@ -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)