fix: subteam invite org acceptance (#11449)
This commit is contained in:
1 parent
37f01db0da
commit
3fdc41968f
3 files changed
+2
-12
No files matched your search
@@ -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
|
// Accept any child team invites for orgs and create a membership for the org itself
|
||||||
if (team.parentId) {
|
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
|
// 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({
|
await prisma.membership.updateMany({
|
||||||
where: {
|
where: {
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
|
|||||||
const isOrganization = tokenTeam.metadata?.isOrganization || tokenTeam?.parentId !== null;
|
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
|
// If we are dealing with an org, the slug may come from the team itself or its parent
|
||||||
const orgSlug = isOrganization
|
const orgSlug = isOrganization
|
||||||
? tokenTeam.slug || tokenTeam.metadata?.requestedSlug || tokenTeam.parent?.slug
|
? tokenTeam.metadata?.requestedSlug || tokenTeam.parent?.slug || tokenTeam.slug
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
// Org context shouldn't check if a username is premium
|
// Org context shouldn't check if a username is premium
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ export async function sendVerificationEmail({
|
|||||||
expires: new Date(new Date().setHours(168)), // +1 week
|
expires: new Date(new Date().setHours(168)), // +1 week
|
||||||
team: {
|
team: {
|
||||||
connect: {
|
connect: {
|
||||||
id: connectionInfo.orgId || input.teamId,
|
id: input.teamId,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user