diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-20 15:54:32 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-02-20 15:54:32 +0100 |
commit | dee77e767f27b6749a334451a8f1aa25872a6a0b (patch) | |
tree | 2cf24ea839f9a48453022f9245492c5e447d6a09 /server/lib | |
parent | ef80c66cea945d315336251dbb5efcb06c64189d (diff) | |
download | PeerTube-dee77e767f27b6749a334451a8f1aa25872a6a0b.tar.gz PeerTube-dee77e767f27b6749a334451a8f1aa25872a6a0b.tar.zst PeerTube-dee77e767f27b6749a334451a8f1aa25872a6a0b.zip |
Create send email type
Instead of using email job handler payload type
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/emailer.ts | 12 | ||||
-rw-r--r-- | server/lib/job-queue/handlers/email.ts | 11 |
2 files changed, 13 insertions, 10 deletions
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' | |||
13 | import { VideoImportModel } from '../models/video/video-import' | 13 | import { VideoImportModel } from '../models/video/video-import' |
14 | import { ActorFollowModel } from '../models/activitypub/actor-follow' | 14 | import { ActorFollowModel } from '../models/activitypub/actor-follow' |
15 | 15 | ||
16 | type SendEmailOptions = { | ||
17 | to: string[] | ||
18 | subject: string | ||
19 | text: string | ||
20 | |||
21 | fromDisplayName?: string | ||
22 | replyTo?: string | ||
23 | } | ||
24 | |||
16 | class Emailer { | 25 | class Emailer { |
17 | 26 | ||
18 | private static instance: Emailer | 27 | private static instance: Emailer |
@@ -402,5 +411,6 @@ class Emailer { | |||
402 | // --------------------------------------------------------------------------- | 411 | // --------------------------------------------------------------------------- |
403 | 412 | ||
404 | export { | 413 | export { |
405 | Emailer | 414 | Emailer, |
415 | SendEmailOptions | ||
406 | } | 416 | } |
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 @@ | |||
1 | import * as Bull from 'bull' | 1 | import * as Bull from 'bull' |
2 | import { logger } from '../../../helpers/logger' | 2 | import { logger } from '../../../helpers/logger' |
3 | import { Emailer } from '../../emailer' | 3 | import { Emailer, SendEmailOptions } from '../../emailer' |
4 | 4 | ||
5 | export type EmailPayload = { | 5 | export type EmailPayload = SendEmailOptions |
6 | to: string[] | ||
7 | subject: string | ||
8 | text: string | ||
9 | |||
10 | fromDisplayName?: string | ||
11 | replyTo?: string | ||
12 | } | ||
13 | 6 | ||
14 | async function processEmail (job: Bull.Job) { | 7 | async function processEmail (job: Bull.Job) { |
15 | const payload = job.data as EmailPayload | 8 | const payload = job.data as EmailPayload |