fix: Creating teams for organizations in wizard#9632
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| "my_profile": "My Profile", | ||
| "my_settings": "My Settings", | ||
| "sender_id_info": "Name or number shown as the sender of an SMS (some countries do not allow alphanumeric sender IDs)", | ||
| "no_organization_slug": "There was an error creating teams for this organization. Missing URL slug.", |
There was a problem hiding this comment.
Adding a proper message for the error to not show coded to the end user
| }, | ||
| onError: (error) => { | ||
| showToast(error.message, "error"); | ||
| showToast(t(error.message), "error"); |
There was a problem hiding this comment.
Show the translated message to the end user, not the code
| ...(!IS_TEAM_BILLING_ENABLED && { slug }), | ||
| metadata: { | ||
| requestedSlug: slug, | ||
| ...(IS_TEAM_BILLING_ENABLED && { requestedSlug: slug }), |
There was a problem hiding this comment.
Adding the check to not have the metadata if we are not in a team-billing environment
| const organization = await prisma.team.findFirst({ where: { id: orgId }, select: { metadata: true } }); | ||
| const organization = await prisma.team.findFirst({ | ||
| where: { id: orgId }, | ||
| select: { slug: true, metadata: true }, |
There was a problem hiding this comment.
Be sure to also get slug from the newly created org to check for it too
| const metadata = teamMetadataSchema.parse(organization?.metadata); | ||
|
|
||
| if (!metadata?.requestedSlug) throw new TRPCError({ code: "BAD_REQUEST", message: "no_organization" }); | ||
| if (!metadata?.requestedSlug || !organization?.slug) |
There was a problem hiding this comment.
Not only rely on requestedSlug to show an error, when no team-billing is enabled, org slug is the one defined.
There was a problem hiding this comment.
I am still getting the error, should that be && maybe?
|
|
||
| if (!metadata?.requestedSlug) throw new TRPCError({ code: "BAD_REQUEST", message: "no_organization" }); | ||
| if (!metadata?.requestedSlug || !organization?.slug) | ||
| throw new TRPCError({ code: "BAD_REQUEST", message: "no_organization_slug" }); |
There was a problem hiding this comment.
Making the error code more specific.
📦 Next.js Bundle Analysis for @calcom/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
Current Playwright Test Results Summary✅ 108 Passing - Run may still be in progress, this comment will be updated as current testing workflow or job completes... (Last updated on 06/19/2023 02:36:54pm UTC) Run DetailsRunning Workflow PR Update on Github Actions Commit: 0c313bc Started: 06/19/2023 02:34:15pm UTC
|
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
2FA Tests should allow a user to disable 2FA
Retry 2 • Retry 1 • Initial Attempt |
3.41% (10)10 / 293 runsfailed over last 7 days |
26.96% (79)79 / 293 runsflaked over last 7 days |
📄 apps/web/playwright/event-types.e2e.ts • 1 Flake
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
Event Types tests user -- old-booker can add multiple organizer address
Retry 1 • Initial Attempt |
1.38% (4)4 / 290 runsfailed over last 7 days |
29.31% (85)85 / 290 runsflaked over last 7 days |
📄 apps/web/playwright/webhook.e2e.ts • 1 Flake
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
FORM_SUBMITTED can submit a form and get a submission event
Retry 1 • Initial Attempt |
4.15% (9)9 / 217 runsfailed over last 7 days |
15.67% (34)34 / 217 runsflaked over last 7 days |
emrysal
left a comment
There was a problem hiding this comment.
minor unrelated nit - looks good
| throw new TRPCError({ code: "BAD_REQUEST", message: "no_organization_slug" }); | ||
|
|
||
| const userMembership = await prisma.membership.findFirst({ | ||
| where: { |
There was a problem hiding this comment.
Not directly related to this PR, but this needs a check to confirm the membership isn't pending
There was a problem hiding this comment.
| where: { | |
| where: { | |
| accepted: true, |
What does this PR do?
When added the possibility to register an org checking if billing was enabled, we introduced a ramification where
requestedSlugmetadata property was not set but we relied on it to let the user create new teams. Expanding that check to cover the other scenario as well.Type of change
How should this be tested?
Go to the org wizard and create teams, it should let you do it in a non-team-billing environment scenario.
Mandatory Tasks