Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Commit

Permalink
fix: subteam invite org acceptance (calcom#11449)
Browse files Browse the repository at this point in the history
  • Loading branch information
leog authored Sep 19, 2023
1 parent 37f01db commit 3fdc419
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
10 changes: 0 additions & 10 deletions apps/web/pages/api/auth/signup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)

// Accept any child team invites for orgs and create a membership for the org itself
if (team.parentId) {
// Create a membership for the organization itself
await prisma.membership.create({
data: {
userId: user.id,
teamId: team.parentId,
accepted: true,
role: MembershipRole.MEMBER,
},
});

// We do a membership update twice so we can join the ORG invite if the user is invited to a team witin a ORG
await prisma.membership.updateMany({
where: {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/pages/signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
const isOrganization = tokenTeam.metadata?.isOrganization || tokenTeam?.parentId !== null;
// If we are dealing with an org, the slug may come from the team itself or its parent
const orgSlug = isOrganization
? tokenTeam.slug || tokenTeam.metadata?.requestedSlug || tokenTeam.parent?.slug
? tokenTeam.metadata?.requestedSlug || tokenTeam.parent?.slug || tokenTeam.slug
: null;

// Org context shouldn't check if a username is premium
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export async function sendVerificationEmail({
expires: new Date(new Date().setHours(168)), // +1 week
team: {
connect: {
id: connectionInfo.orgId || input.teamId,
id: input.teamId,
},
},
},
Expand Down

0 comments on commit 3fdc419

Please sign in to comment.