]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/models/server/emailer.model.ts
Fix live ending job that breaks new live session
[github/Chocobozzz/PeerTube.git] / shared / models / server / emailer.model.ts
index 069ef0bab5253e1d4fc0a1e95a98ee1fe385ffea..39512d306147b8e6ac5301ef5ca0d088af52cdb9 100644 (file)
@@ -1,12 +1,49 @@
-export type SendEmailOptions = {
-  to: string[]
+type From = string | { name?: string, address: string }
 
-  template?: string
+interface Base extends Partial<SendEmailDefaultMessageOptions> {
+  to: string[] | string
+}
+
+interface MailTemplate extends Base {
+  template: string
   locals?: { [key: string]: any }
+  text?: undefined
+}
+
+interface MailText extends Base {
+  text: string
 
-  // override defaults
-  subject?: string
-  text?: string
-  from?: string | { name?: string, address: string }
-  replyTo?: string
+  locals?: Partial<SendEmailDefaultLocalsOptions> & {
+    title?: string
+    action?: {
+      url: string
+      text: string
+    }
+  }
 }
+
+interface SendEmailDefaultLocalsOptions {
+  instanceName: string
+  text: string
+  subject: string
+}
+
+interface SendEmailDefaultMessageOptions {
+  to: string[] | string
+  from: From
+  subject: string
+  replyTo: string
+}
+
+export type SendEmailDefaultOptions = {
+  template: 'common'
+
+  message: SendEmailDefaultMessageOptions
+
+  locals: SendEmailDefaultLocalsOptions & {
+    WEBSERVER: any
+    EMAIL: any
+  }
+}
+
+export type SendEmailOptions = MailTemplate | MailText