+ async addVideoAbuseReport (videoId: number) {
+ const video = await VideoModel.load(videoId)
+ if (!video) throw new Error('Unknown Video id during Abuse report.')
+
+ const text = `Hi,\n\n` +
+ `Your instance received an abuse for the following video ${video.url}\n\n` +
+ `Cheers,\n` +
+ `PeerTube.`
+
+ const to = await UserModel.listEmailsWithRight(UserRight.MANAGE_VIDEO_ABUSES)
+ const emailPayload: EmailPayload = {
+ to,
+ subject: '[PeerTube] Received a video abuse',
+ text
+ }
+
+ return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload })
+ }
+