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:
@ -3,7 +3,7 @@ import subMinutes from "date-fns/sub_minutes";
|
||||
import Router from "koa-router";
|
||||
import { find } from "lodash";
|
||||
import { AuthorizationError } from "../../errors";
|
||||
import mailer from "../../mailer";
|
||||
import mailer, { sendEmail } from "../../mailer";
|
||||
import methodOverride from "../../middlewares/methodOverride";
|
||||
import validation from "../../middlewares/validation";
|
||||
import { User, Team } from "../../models";
|
||||
@ -97,6 +97,9 @@ router.get("email.callback", async (ctx) => {
|
||||
if (user.isSuspended) {
|
||||
return ctx.redirect("/?notice=suspended");
|
||||
}
|
||||
if (user.isInvited) {
|
||||
sendEmail("welcome", user.email, { teamUrl: user.team.url });
|
||||
}
|
||||
|
||||
await user.update({ lastActiveAt: new Date() });
|
||||
|
||||
|
Reference in New Issue
Block a user