fix resend team member invite (#12360)
This commit is contained in:
@@ -4,8 +4,6 @@ import { getTranslation } from "@calcom/lib/server/i18n";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import type { TrpcSessionUser } from "@calcom/trpc/server/trpc";
|
||||
|
||||
import { TRPCError } from "@trpc/server";
|
||||
|
||||
import { checkPermissions, getTeamOrThrow } from "./inviteMember/utils";
|
||||
import type { TResendInvitationInputSchema } from "./resendInvitation.schema";
|
||||
|
||||
@@ -36,8 +34,16 @@ export const resendInvitationHandler = async ({ ctx, input }: InviteMemberOption
|
||||
},
|
||||
});
|
||||
|
||||
if (!verificationToken)
|
||||
throw new TRPCError({ code: "NOT_FOUND", message: "Couldn't resend, no existing invitation found." });
|
||||
const inviteTeamOptions = {
|
||||
joinLink: `${WEBAPP_URL}/auth/login?callbackUrl=/settings/teams`,
|
||||
isCalcomMember: true,
|
||||
};
|
||||
|
||||
if (verificationToken) {
|
||||
// Token only exists if user is CAL user but hasn't completed onboarding.
|
||||
inviteTeamOptions.joinLink = `${WEBAPP_URL}/signup?token=${verificationToken.token}&callbackUrl=/getting-started`;
|
||||
inviteTeamOptions.isCalcomMember = false;
|
||||
}
|
||||
|
||||
const translation = await getTranslation(input.language ?? "en", "common");
|
||||
|
||||
@@ -46,8 +52,7 @@ export const resendInvitationHandler = async ({ ctx, input }: InviteMemberOption
|
||||
from: ctx.user.name || `${team.name}'s admin`,
|
||||
to: input.email,
|
||||
teamName: team?.parent?.name || team.name,
|
||||
joinLink: `${WEBAPP_URL}/signup?token=${verificationToken.token}&callbackUrl=/getting-started`,
|
||||
isCalcomMember: false,
|
||||
...inviteTeamOptions,
|
||||
isOrg: input.isOrg,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user