aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-07-24 15:05:51 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-07-31 11:35:19 +0200
commitedbc9325462ddf4536775871ebc25e06f46612d1 (patch)
tree9671dd51303e75d48d4f4f9a1df7a1960e33780d /server/lib
parent20516920d2b72c8a18bc24b9740f7176aa962da2 (diff)
downloadPeerTube-edbc9325462ddf4536775871ebc25e06f46612d1.tar.gz
PeerTube-edbc9325462ddf4536775871ebc25e06f46612d1.tar.zst
PeerTube-edbc9325462ddf4536775871ebc25e06f46612d1.zip
Add server API to abuse messages
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/emailer.ts4
-rw-r--r--server/lib/moderation.ts2
-rw-r--r--server/lib/notifier.ts6
3 files changed, 6 insertions, 6 deletions
diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts
index 48ba7421e..c6ad03328 100644
--- a/server/lib/emailer.ts
+++ b/server/lib/emailer.ts
@@ -5,7 +5,7 @@ import { join } from 'path'
5import { VideoChannelModel } from '@server/models/video/video-channel' 5import { VideoChannelModel } from '@server/models/video/video-channel'
6import { MVideoBlacklistLightVideo, MVideoBlacklistVideo } from '@server/types/models/video/video-blacklist' 6import { MVideoBlacklistLightVideo, MVideoBlacklistVideo } from '@server/types/models/video/video-blacklist'
7import { MVideoImport, MVideoImportVideo } from '@server/types/models/video/video-import' 7import { MVideoImport, MVideoImportVideo } from '@server/types/models/video/video-import'
8import { Abuse, EmailPayload } from '@shared/models' 8import { UserAbuse, EmailPayload } from '@shared/models'
9import { SendEmailOptions } from '../../shared/models/server/emailer.model' 9import { SendEmailOptions } from '../../shared/models/server/emailer.model'
10import { isTestInstance, root } from '../helpers/core-utils' 10import { isTestInstance, root } from '../helpers/core-utils'
11import { bunyanLogger, logger } from '../helpers/logger' 11import { bunyanLogger, logger } from '../helpers/logger'
@@ -283,7 +283,7 @@ class Emailer {
283 } 283 }
284 284
285 addAbuseModeratorsNotification (to: string[], parameters: { 285 addAbuseModeratorsNotification (to: string[], parameters: {
286 abuse: Abuse 286 abuse: UserAbuse
287 abuseInstance: MAbuseFull 287 abuseInstance: MAbuseFull
288 reporter: string 288 reporter: string
289 }) { 289 }) {
diff --git a/server/lib/moderation.ts b/server/lib/moderation.ts
index 4fc9cd747..b140d5aa9 100644
--- a/server/lib/moderation.ts
+++ b/server/lib/moderation.ts
@@ -213,7 +213,7 @@ async function createAbuse (options: {
213 await sendAbuse(reporterAccount.Actor, abuseInstance, abuseInstance.FlaggedAccount, transaction) 213 await sendAbuse(reporterAccount.Actor, abuseInstance, abuseInstance.FlaggedAccount, transaction)
214 } 214 }
215 215
216 const abuseJSON = abuseInstance.toFormattedJSON() 216 const abuseJSON = abuseInstance.toFormattedAdminJSON()
217 auditLogger.create(reporterAccount.Actor.getIdentifier(), new AbuseAuditView(abuseJSON)) 217 auditLogger.create(reporterAccount.Actor.getIdentifier(), new AbuseAuditView(abuseJSON))
218 218
219 Notifier.Instance.notifyOnNewAbuse({ 219 Notifier.Instance.notifyOnNewAbuse({
diff --git a/server/lib/notifier.ts b/server/lib/notifier.ts
index c567e1c20..8f165d2fd 100644
--- a/server/lib/notifier.ts
+++ b/server/lib/notifier.ts
@@ -10,7 +10,7 @@ import {
10} from '@server/types/models/user' 10} from '@server/types/models/user'
11import { MVideoBlacklistLightVideo, MVideoBlacklistVideo } from '@server/types/models/video/video-blacklist' 11import { MVideoBlacklistLightVideo, MVideoBlacklistVideo } from '@server/types/models/video/video-blacklist'
12import { MVideoImportVideo } from '@server/types/models/video/video-import' 12import { MVideoImportVideo } from '@server/types/models/video/video-import'
13import { Abuse } from '@shared/models' 13import { UserAbuse } from '@shared/models'
14import { UserNotificationSettingValue, UserNotificationType, UserRight } from '../../shared/models/users' 14import { UserNotificationSettingValue, UserNotificationType, UserRight } from '../../shared/models/users'
15import { VideoPrivacy, VideoState } from '../../shared/models/videos' 15import { VideoPrivacy, VideoState } from '../../shared/models/videos'
16import { logger } from '../helpers/logger' 16import { logger } from '../helpers/logger'
@@ -73,7 +73,7 @@ class Notifier {
73 .catch(err => logger.error('Cannot notify mentions of comment %s.', comment.url, { err })) 73 .catch(err => logger.error('Cannot notify mentions of comment %s.', comment.url, { err }))
74 } 74 }
75 75
76 notifyOnNewAbuse (parameters: { abuse: Abuse, abuseInstance: MAbuseFull, reporter: string }): void { 76 notifyOnNewAbuse (parameters: { abuse: UserAbuse, abuseInstance: MAbuseFull, reporter: string }): void {
77 this.notifyModeratorsOfNewAbuse(parameters) 77 this.notifyModeratorsOfNewAbuse(parameters)
78 .catch(err => logger.error('Cannot notify of new abuse %d.', parameters.abuseInstance.id, { err })) 78 .catch(err => logger.error('Cannot notify of new abuse %d.', parameters.abuseInstance.id, { err }))
79 } 79 }
@@ -350,7 +350,7 @@ class Notifier {
350 } 350 }
351 351
352 private async notifyModeratorsOfNewAbuse (parameters: { 352 private async notifyModeratorsOfNewAbuse (parameters: {
353 abuse: Abuse 353 abuse: UserAbuse
354 abuseInstance: MAbuseFull 354 abuseInstance: MAbuseFull
355 reporter: string 355 reporter: string
356 }) { 356 }) {