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

Commit

Permalink
fix: team members not showing up in org members list (calcom#11456)
Browse files Browse the repository at this point in the history
* fix: team members not showing up in org members list

Signed-off-by: Udit Takkar <[email protected]>

* fix: use upsert

Signed-off-by: Udit Takkar <[email protected]>

* Update apps/web/pages/api/auth/signup.ts

Co-authored-by: Leo Giovanetti <[email protected]>

---------

Signed-off-by: Udit Takkar <[email protected]>
Co-authored-by: Leo Giovanetti <[email protected]>
  • Loading branch information
Udit-takkar and leog authored Sep 21, 2023
1 parent 3a3d8db commit 96263b0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions apps/web/pages/api/auth/signup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,22 @@ 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 (when invite link is used) or Update (when regular email invitation is used) membership for the organization itself
await prisma.membership.upsert({
where: {
userId_teamId: { userId: user.id, teamId: team.parentId },
},
update: {
accepted: true,
},
create: {
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

0 comments on commit 96263b0

Please sign in to comment.