chore: Email + mailer refactor (#3342)

* Huge email refactor

* fix: One rename too many

* comments
This commit is contained in:
Tom Moor
2022-04-07 16:50:04 -07:00
committed by GitHub
parent 15375bf199
commit 5c24f9e1d5
39 changed files with 879 additions and 870 deletions

View File

@@ -1,9 +1,9 @@
import invariant from "invariant";
import { uniqBy } from "lodash";
import { Role } from "@shared/types";
import InviteEmail from "@server/emails/templates/InviteEmail";
import Logger from "@server/logging/logger";
import { User, Event, Team } from "@server/models";
import EmailTask from "@server/queues/tasks/EmailTask";
type Invite = {
name: string;
@@ -75,16 +75,13 @@ export default async function userInviter({
ip,
});
await EmailTask.schedule({
type: "invite",
options: {
to: invite.email,
name: invite.name,
actorName: user.name,
actorEmail: user.email,
teamName: team.name,
teamUrl: team.url,
},
await InviteEmail.schedule({
to: invite.email,
name: invite.name,
actorName: user.name,
actorEmail: user.email,
teamName: team.name,
teamUrl: team.url,
});
if (process.env.NODE_ENV === "development") {