From dee77e767f27b6749a334451a8f1aa25872a6a0b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 20 Feb 2019 15:54:32 +0100 Subject: Create send email type Instead of using email job handler payload type --- server/lib/emailer.ts | 12 +++++++++++- server/lib/job-queue/handlers/email.ts | 11 ++--------- 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'server/lib') diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts index cbe384061..04e4b94b6 100644 --- a/server/lib/emailer.ts +++ b/server/lib/emailer.ts @@ -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 } diff --git a/server/lib/job-queue/handlers/email.ts b/server/lib/job-queue/handlers/email.ts index 2ba39a156..62701222c 100644 --- a/server/lib/job-queue/handlers/email.ts +++ b/server/lib/job-queue/handlers/email.ts @@ -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 -- cgit v1.2.3