fix: Welcome emails should not be sent when inviting a user (#2132)

* chore: Bump nodemailer

* fix: Welcome email sent to invites

* test: Add regression test for emails from accountProvisioner
This commit is contained in:
Tom Moor
2021-05-11 18:59:31 -07:00
committed by GitHub
parent 456a7e497b
commit 2cb0bab82a
7 changed files with 27 additions and 12 deletions

View File

@ -6,6 +6,7 @@ import {
EmailAuthenticationRequiredError,
AuthenticationProviderDisabledError,
} from "../errors";
import { sendEmail } from "../mailer";
import { Team, User } from "../models";
import teamCreator from "./teamCreator";
import userCreator from "./userCreator";
@ -85,6 +86,10 @@ export default async function accountProvisioner({
const { isNewUser, user } = result;
if (isNewUser) {
sendEmail("welcome", user.email, { teamUrl: team.url });
}
if (isNewTeam) {
await team.provisionFirstCollection(user.id);
}