diff options
author | Chocobozzz <me@florianbigard.com> | 2021-03-12 10:22:17 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-03-24 18:18:41 +0100 |
commit | cae2df6bdc3c3590df32bf7431a617177be30429 (patch) | |
tree | f1f9680f7ca39454748302bf290c9ac01361a2f5 /shared/models/server | |
parent | 32a18cbf33a7cdbbe3d4885d32e4b67e19cdc1cf (diff) | |
download | PeerTube-cae2df6bdc3c3590df32bf7431a617177be30429.tar.gz PeerTube-cae2df6bdc3c3590df32bf7431a617177be30429.tar.zst PeerTube-cae2df6bdc3c3590df32bf7431a617177be30429.zip |
Stricter email options typings
Diffstat (limited to 'shared/models/server')
-rw-r--r-- | shared/models/server/emailer.model.ts | 53 |
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 @@ | |||
1 | export type SendEmailOptions = { | 1 | type From = string | { name?: string, address: string } |
2 | to: string[] | ||
3 | 2 | ||
4 | template?: string | 3 | interface Base extends Partial<SendEmailDefaultMessageOptions> { |
4 | to: string[] | string | ||
5 | } | ||
6 | |||
7 | interface MailTemplate extends Base { | ||
8 | template: string | ||
5 | locals?: { [key: string]: any } | 9 | locals?: { [key: string]: any } |
10 | text?: undefined | ||
11 | } | ||
12 | |||
13 | interface 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 | |||
25 | interface SendEmailDefaultLocalsOptions { | ||
26 | instanceName: string | ||
27 | text: string | ||
28 | subject: string | ||
29 | } | ||
30 | |||
31 | interface SendEmailDefaultMessageOptions { | ||
32 | to: string[] | string | ||
33 | from: From | ||
34 | subject: string | ||
35 | replyTo: string | ||
36 | } | ||
37 | |||
38 | export type SendEmailDefaultOptions = { | ||
39 | template: 'common' | ||
40 | |||
41 | message: SendEmailDefaultMessageOptions | ||
42 | |||
43 | locals: SendEmailDefaultLocalsOptions & { | ||
44 | WEBSERVER: any | ||
45 | EMAIL: any | ||
46 | } | ||
47 | } | ||
48 | |||
49 | export type SendEmailOptions = MailTemplate | MailText | ||