diff options
author | Chocobozzz <me@florianbigard.com> | 2021-03-04 16:12:46 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-03-04 16:16:37 +0100 |
commit | a2eba50b8eee6d13b46425af05ef24025a173801 (patch) | |
tree | 7238d4c71b8de33a5d179b445dff18bc2f199555 /server/lib | |
parent | 8726cd494110d2cb2f5302e9347128e84306cc63 (diff) | |
download | PeerTube-a2eba50b8eee6d13b46425af05ef24025a173801.tar.gz PeerTube-a2eba50b8eee6d13b46425af05ef24025a173801.tar.zst PeerTube-a2eba50b8eee6d13b46425af05ef24025a173801.zip |
Fix moderation notification
Diffstat (limited to 'server/lib')
-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) |