Skip to content

fix: removed condition for hidden emails to be checked even if it is required#24431

Closed
Spandan-Mishra wants to merge 1 commit intocalcom:mainfrom
Spandan-Mishra:hidden-email-fix
Closed

fix: removed condition for hidden emails to be checked even if it is required#24431
Spandan-Mishra wants to merge 1 commit intocalcom:mainfrom
Spandan-Mishra:hidden-email-fix

Conversation

@Spandan-Mishra
Copy link
Contributor

What does this PR do?

Visual Demo (For contributors especially)

A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).

Video Demo (if applicable):

Before:

2025-10-13.18-48-50.mp4

After:

2025-10-13.20-15-15.mp4

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox. - N/A
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Create an event-type and make its email field hidden
  • Go to the booking page and enter required information
  • Confirm the booking and see that it is now showing successful creation

@Spandan-Mishra Spandan-Mishra requested a review from a team as a code owner October 13, 2025 14:48
@vercel
Copy link

vercel bot commented Oct 13, 2025

@Spandan-Mishra is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant
Copy link

CLAassistant commented Oct 13, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added booking-page area: booking page, public booking page, booker Medium priority Created by Linear-GitHub Sync 🐛 bug Something isn't working labels Oct 13, 2025
@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Oct 13, 2025
@graphite-app graphite-app bot requested a review from a team October 13, 2025 14:48
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 13, 2025

Walkthrough

  • Updated packages/features/bookings/lib/getBookingResponsesSchema.ts.
  • Added error logging within the JSON.parse catch when parsing radioInput values.
  • Simplified the gating logic for the email field by removing a ternary condition; schema now proceeds when the field is not hidden and checkOptional is truthy.
  • No changes to exported or public declarations.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The addition of error logging in the JSON.parse catch for radioInput value parsing is not related to the hidden email validation fix described in the linked issues and falls outside the stated objectives. This change introduces functionality beyond the scope of resolving the email booking field logic. Please isolate the error logging addition into a separate pull request or document its purpose clearly to keep this fix focused on the email validation issue.
✅ Passed checks (4 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly describes the core change of removing the validation condition for hidden email fields and aligns directly with the main purpose of the pull request. It clearly indicates that a fix was made to the email checking logic when the field is hidden yet required. The phrasing is concise and specific enough for team members to understand the primary change at a glance.
Linked Issues Check ✅ Passed The submitted changes remove the unintended email validation for hidden fields and restore the expected behavior described in issues #24369 and CAL-6552, matching the linked issues’ reproduction steps and error symptom. The logic adjustment directly addresses the primary objective of preventing email validation from blocking booking confirmation when the field is hidden.
Description Check ✅ Passed The description thoroughly covers the issues being fixed, references the relevant tickets, outlines the code change regarding the hidden email field, notes linting corrections, and provides testing steps and visual demos. It is fully on-topic and directly related to the modifications in the pull request.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dosubot dosubot bot added the bookings area: bookings, availability, timezones, double booking label Oct 13, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/features/bookings/lib/getBookingResponsesSchema.ts (1)

105-107: Consider structured logging or log level adjustment.

The error logging helps with debugging, but since execution continues safely with default values, consider whether this should be a warning instead of an error, or add more context about the field name to aid debugging.

Example adjustment:

 } catch (error) {
-  console.error("Failed to parse radioInput value as JSON:", error);
+  console.warn(`Failed to parse radioInput value for field "${field.name}":`, error);
 }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1dc20e3 and 1d609b5.

📒 Files selected for processing (1)
  • packages/features/bookings/lib/getBookingResponsesSchema.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/features/bookings/lib/getBookingResponsesSchema.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/features/bookings/lib/getBookingResponsesSchema.ts
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.

Files:

  • packages/features/bookings/lib/getBookingResponsesSchema.ts
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (1)
packages/features/bookings/lib/getBookingResponsesSchema.ts (1)

178-178: LGTM! The simplified condition correctly prevents validation of hidden email fields.

The change from the previous ternary condition to the explicit check !bookingField.hidden && checkOptional directly addresses the reported issue. By gating email validation on both the field not being hidden and the checkOptional flag, hidden email fields will no longer trigger validation errors during booking confirmation, even when prefilled.

This is consistent with the phone field validation pattern at line 284 and aligns with the comment at line 163: "If the field is hidden, then it can never be required."

Please verify this resolves the issue by following the testing steps from the PR description:

  1. Create an event type with its email field hidden
  2. Complete the booking page with required information
  3. Confirm booking succeeds without console errors about email_validation_error

Additionally, verify that when the email field is visible and has validation rules (excluded/required emails), those validations still work correctly.

@anikdhabal
Copy link
Contributor

@Spandan-Mishra i've fixed it here:- #24432
Thanks for your work

@anikdhabal anikdhabal closed this Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

booking-page area: booking page, public booking page, booker bookings area: bookings, availability, timezones, double booking 🐛 bug Something isn't working community Created by Linear-GitHub Sync Medium priority Created by Linear-GitHub Sync size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Email validation error occurs when email field is hidden, even if prefilled — used to work before.”

3 participants