aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-03-04 16:12:46 +0100
committerChocobozzz <me@florianbigard.com>2021-03-04 16:16:37 +0100
commita2eba50b8eee6d13b46425af05ef24025a173801 (patch)
tree7238d4c71b8de33a5d179b445dff18bc2f199555 /server/lib
parent8726cd494110d2cb2f5302e9347128e84306cc63 (diff)
downloadPeerTube-a2eba50b8eee6d13b46425af05ef24025a173801.tar.gz
PeerTube-a2eba50b8eee6d13b46425af05ef24025a173801.tar.zst
PeerTube-a2eba50b8eee6d13b46425af05ef24025a173801.zip
Fix moderation notification
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)