fix(api-v2-bookings): prevent loss of user provided emails when email is hidden but still passed#28845
fix(api-v2-bookings): prevent loss of user provided emails when email is hidden but still passed#28845bandhan-majumder wants to merge 2 commits intocalcom:mainfrom
Conversation
… is hidden but still passed
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThe booking data handler was changed to copy 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/features/bookings/lib/handleNewBooking/getBookingData.ts`:
- Around line 27-30: The code in getBookingData.ts dereferences
reqBody.responses.email and parsedBody.responses.email without ensuring
responses exists; update the conditional to guard nested access (use
reqBody.responses?.email) and ensure parsedBody.responses is initialized before
assigning (e.g., if (reqBody.responses?.email && !parsedBody.responses?.email) {
parsedBody.responses = parsedBody.responses || {}; parsedBody.responses.email =
reqBody.responses.email; }) so accessing/setting email cannot throw; adjust the
conditional around reqBody and parsedBody in the getBookingData logic
accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 279564bd-7ce6-4fb5-8098-e78b11b0ce4e
📒 Files selected for processing (2)
packages/features/bookings/lib/handleNewBooking/getBookingData.test.tspackages/features/bookings/lib/handleNewBooking/getBookingData.ts
What does this PR do?
Adds user provided email in in the parsed data when event type has email hdden but user still passes email in the request body object
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:
before.mp4
After:
after.mp4
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
send this type of data :
with headers:
Authorization: <API_TOKEN>
cal-api-version: 2024-08-13
Content-Type: application/json
Checklist