feat: Add optional notification email when invite is accepted (#3718)

* feat: Add optional notification email when invite is accepted

* Refactor to use beforeSend
This commit is contained in:
Tom Moor
2022-07-02 15:40:40 +03:00
committed by GitHub
parent ee22a127f6
commit 863f22750f
14 changed files with 169 additions and 66 deletions

View File

@@ -40,7 +40,8 @@ export async function signIn(
}
// update the database when the user last signed in
user.updateSignedIn(ctx.request.ip);
await user.updateSignedIn(ctx.request.ip);
// don't await event creation for a faster sign-in
Event.create({
name: "users.signin",

View File

@@ -82,14 +82,7 @@ export async function getUserForEmailSigninToken(token: string): Promise<User> {
}
}
const user = await User.findByPk(payload.id, {
include: [
{
model: Team,
required: true,
},
],
});
const user = await User.scope("withTeam").findByPk(payload.id);
invariant(user, "User not found");
try {