Create send email type
authorChocobozzz <me@florianbigard.com>
Wed, 20 Feb 2019 14:54:32 +0000 (15:54 +0100)
committerChocobozzz <me@florianbigard.com>
Wed, 20 Feb 2019 14:54:32 +0000 (15:54 +0100)
Instead of using email job handler payload type

server/lib/emailer.ts
server/lib/job-queue/handlers/email.ts

index cbe384061355d8626029c89f27330b6e5cca80c2..04e4b94b6da83ce5a04b7fa589e098fdef0e51ce 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
@@ -402,5 +411,6 @@ class Emailer {
 // ---------------------------------------------------------------------------
 
 export {
-  Emailer
+  Emailer,
+  SendEmailOptions
 }
index 2ba39a156d805e8e0c1af2c6925410613c80f70b..62701222cb2b872a578738e614684565a5c24801 100644 (file)
@@ -1,15 +1,8 @@
 import * as Bull from 'bull'
 import { logger } from '../../../helpers/logger'
-import { Emailer } from '../../emailer'
+import { Emailer, SendEmailOptions } from '../../emailer'
 
-export type EmailPayload = {
-  to: string[]
-  subject: string
-  text: string
-
-  fromDisplayName?: string
-  replyTo?: string
-}
+export type EmailPayload = SendEmailOptions
 
 async function processEmail (job: Bull.Job) {
   const payload = job.data as EmailPayload