Comment notification emails (#4978)

* Comment notification emails

* fix links
fix threading in email inboxes
from is now commenter name

* fix

* refactor

* fix async filter
This commit is contained in:
Tom Moor
2023-03-05 11:01:56 -05:00
committed by GitHub
parent 4ff0fdfb4f
commit 760355302c
10 changed files with 599 additions and 236 deletions

View File

@@ -18,6 +18,7 @@ export default abstract class BaseEmail<T extends EmailProps, S = unknown> {
* Schedule this email type to be sent asyncronously by a worker.
*
* @param props Properties to be used in the email template
* @param metadata Optional metadata to be stored with the notification
* @returns A promise that resolves once the email is placed on the task queue
*/
public static schedule<T>(props: T, metadata?: NotificationMetadata) {
@@ -77,6 +78,7 @@ export default abstract class BaseEmail<T extends EmailProps, S = unknown> {
try {
await mailer.sendMail({
to: this.props.to,
fromName: this.fromName?.(data),
subject: this.subject(data),
previewText: this.preview(data),
component: this.render(data),
@@ -163,4 +165,9 @@ export default abstract class BaseEmail<T extends EmailProps, S = unknown> {
* @returns A promise resolving to additional data
*/
protected beforeSend?(props: T): Promise<S | false>;
/**
* fromName hook allows overriding the "from" name of the email.
*/
protected fromName?(props: T): string | undefined;
}