]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/emailer.ts
Add delete/manual approval instance followers in client
[github/Chocobozzz/PeerTube.git] / server / lib / emailer.ts
index cbe384061355d8626029c89f27330b6e5cca80c2..eec97c27ee20066f64851bef0e278418fa367781 100644 (file)
@@ -13,6 +13,15 @@ import { VideoBlacklistModel } from '../models/video/video-blacklist'
 import { VideoImportModel } from '../models/video/video-import'
 import { ActorFollowModel } from '../models/activitypub/actor-follow'
 
+type SendEmailOptions = {
+  to: string[]
+  subject: string
+  text: string
+
+  fromDisplayName?: string
+  replyTo?: string
+}
+
 class Emailer {
 
   private static instance: Emailer
@@ -241,6 +250,29 @@ class Emailer {
     return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload })
   }
 
+  addVideoAutoBlacklistModeratorsNotification (to: string[], video: VideoModel) {
+    const VIDEO_AUTO_BLACKLIST_URL = CONFIG.WEBSERVER.URL + '/admin/moderation/video-auto-blacklist/list'
+    const videoUrl = CONFIG.WEBSERVER.URL + video.getWatchStaticPath()
+
+    const text = `Hi,\n\n` +
+      `A recently added video was auto-blacklisted and requires moderator review before publishing.` +
+      `\n\n` +
+      `You can view it and take appropriate action on ${videoUrl}` +
+      `\n\n` +
+      `A full list of auto-blacklisted videos can be reviewed here: ${VIDEO_AUTO_BLACKLIST_URL}` +
+      `\n\n` +
+      `Cheers,\n` +
+      `PeerTube.`
+
+    const emailPayload: EmailPayload = {
+      to,
+      subject: '[PeerTube] An auto-blacklisted video is awaiting review',
+      text
+    }
+
+    return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload })
+  }
+
   addNewUserRegistrationNotification (to: string[], user: UserModel) {
     const text = `Hi,\n\n` +
       `User ${user.username} just registered on ${CONFIG.WEBSERVER.HOST} PeerTube instance.\n\n` +
@@ -402,5 +434,6 @@ class Emailer {
 // ---------------------------------------------------------------------------
 
 export {
-  Emailer
+  Emailer,
+  SendEmailOptions
 }