fix: subteam invitation without teamId associated (#11222)

This commit is contained in:
Leo Giovanetti
2023-09-08 09:02:12 +01:00
committed by GitHub
parent 9ff7cf650b
commit d8961f8eb9
@@ -239,19 +239,19 @@ export async function sendVerificationEmail({
}) {
const token: string = randomBytes(32).toString("hex");
if (!connectionInfo.autoAccept) {
await prisma.verificationToken.create({
data: {
identifier: usernameOrEmail,
token,
expires: new Date(new Date().setHours(168)), // +1 week
team: {
connect: {
id: connectionInfo.orgId || input.teamId,
},
await prisma.verificationToken.create({
data: {
identifier: usernameOrEmail,
token,
expires: new Date(new Date().setHours(168)), // +1 week
team: {
connect: {
id: connectionInfo.orgId || input.teamId,
},
},
});
},
});
if (!connectionInfo.autoAccept) {
await sendTeamInviteEmail({
language: translation,
from: ctx.user.name || `${team.name}'s admin`,
@@ -262,15 +262,6 @@ export async function sendVerificationEmail({
isOrg: input.isOrg,
});
} else {
// we have already joined the team in createNewUserConnectToOrgIfExists so we dont need to connect via token
await prisma.verificationToken.create({
data: {
identifier: usernameOrEmail,
token,
expires: new Date(new Date().setHours(168)), // +1 week
},
});
await sendOrganizationAutoJoinEmail({
language: translation,
from: ctx.user.name || `${team.name}'s admin`,