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,14 +6,12 @@ import JWT from "jsonwebtoken";
import { v4 as uuidv4 } from "uuid";
import { languages } from "../../shared/i18n";
import { ValidationError } from "../errors";
import { sendEmail } from "../mailer";
import { DataTypes, sequelize, encryptedFields, Op } from "../sequelize";
import { DEFAULT_AVATAR_HOST } from "../utils/avatars";
import { publicS3Endpoint, uploadToS3FromUrl } from "../utils/s3";
import {
UserAuthentication,
Star,
Team,
Collection,
NotificationSetting,
ApiKey,
@ -236,10 +234,6 @@ const removeIdentifyingInfo = async (model, options) => {
User.beforeDestroy(removeIdentifyingInfo);
User.beforeSave(uploadAvatar);
User.beforeCreate(setRandomJwtSecret);
User.afterCreate(async (user) => {
const team = await Team.findByPk(user.teamId);
sendEmail("welcome", user.email, { teamUrl: team.url });
});
// By default when a user signs up we subscribe them to email notifications
// when documents they created are edited by other team members and onboarding