aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-03-12 10:22:17 +0100
committerChocobozzz <me@florianbigard.com>2021-03-24 18:18:41 +0100
commitcae2df6bdc3c3590df32bf7431a617177be30429 (patch)
treef1f9680f7ca39454748302bf290c9ac01361a2f5 /shared
parent32a18cbf33a7cdbbe3d4885d32e4b67e19cdc1cf (diff)
downloadPeerTube-cae2df6bdc3c3590df32bf7431a617177be30429.tar.gz
PeerTube-cae2df6bdc3c3590df32bf7431a617177be30429.tar.zst
PeerTube-cae2df6bdc3c3590df32bf7431a617177be30429.zip
Stricter email options typings
Diffstat (limited to 'shared')
-rw-r--r--shared/models/server/emailer.model.ts53
1 files changed, 45 insertions, 8 deletions
diff --git a/shared/models/server/emailer.model.ts b/shared/models/server/emailer.model.ts
index 069ef0bab..39512d306 100644
--- a/shared/models/server/emailer.model.ts
+++ b/shared/models/server/emailer.model.ts
@@ -1,12 +1,49 @@
1export type SendEmailOptions = { 1type From = string | { name?: string, address: string }
2 to: string[]
3 2
4 template?: string 3interface Base extends Partial<SendEmailDefaultMessageOptions> {
4 to: string[] | string
5}
6
7interface MailTemplate extends Base {
8 template: string
5 locals?: { [key: string]: any } 9 locals?: { [key: string]: any }
10 text?: undefined
11}
12
13interface MailText extends Base {
14 text: string
6 15
7 // override defaults 16 locals?: Partial<SendEmailDefaultLocalsOptions> & {
8 subject?: string 17 title?: string
9 text?: string 18 action?: {
10 from?: string | { name?: string, address: string } 19 url: string
11 replyTo?: string 20 text: string
21 }
22 }
12} 23}
24
25interface SendEmailDefaultLocalsOptions {
26 instanceName: string
27 text: string
28 subject: string
29}
30
31interface SendEmailDefaultMessageOptions {
32 to: string[] | string
33 from: From
34 subject: string
35 replyTo: string
36}
37
38export type SendEmailDefaultOptions = {
39 template: 'common'
40
41 message: SendEmailDefaultMessageOptions
42
43 locals: SendEmailDefaultLocalsOptions & {
44 WEBSERVER: any
45 EMAIL: any
46 }
47}
48
49export type SendEmailOptions = MailTemplate | MailText