-
Notifications
You must be signed in to change notification settings - Fork 11.7k
feat: display assignment reason in organizer emails and booking single view #27192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…e view Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
…ency Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
…isplay Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
- Update CalendarEvent type to use object with category and details - Create shared getAssignmentReasonCategory utility function - Update CalendarEventBuilder to pass both category and details - Update BookingRepository to fetch reasonEnum for category mapping - Update email template to display translated category label with details - Update EventPayloadType to accept new assignment reason structure Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
…ails Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
…ntReason Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 12 files
| bookingInfo.assignmentReason && | ||
| bookingInfo.assignmentReason.length > 0 && | ||
| bookingInfo.assignmentReason[0].reasonEnum && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit we could use null safe accessor ?
What does this PR do?
Adds display of the assignment reason in two places:
This helps organizers understand why a particular booking was assigned to them, especially useful for round-robin and routing form scenarios.
Updates since last revision
getAssignmentReasonCategory(7 tests covering all enum values) andwithAssignmentReasonbuilder method (3 tests)getAssignmentReasonCategory.tsinpackages/features/bookings/lib/to mapAssignmentReasonEnumto translation keysassignmentReasonfromstring | nullto{ category: string; details?: string | null } | nullto support both category and detailsreasonEnumand converts it to a category using the shared utilityreasonEnumandreasonStringfor the email builderType Changes
The
EventPayloadTypewas modified to useOmit<CalendarEvent, "assignmentReason">because:assignmentReasonas{ category, details }objectassignmentReasonas an array of objects withreasonEnumandreasonStringThis allows both use cases to coexist without type conflicts.
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
For organizer emails:
For booking single view:
/booking/[uid]For unit tests:
yarn test packages/features/bookings/lib/getAssignmentReasonCategory.test.tsyarn test packages/features/CalendarEventBuilder.test.ts -t "assignment reason"Checklist
Human Review Checklist
canViewHiddenDatacorrectly gates assignment reason display (same pattern as UTM params)as AssignmentReasonEnumtype cast in booking single view is safeEventPayloadTypechange doesn't break existing webhook consumersCalendarEventBuilder.fromBooking()correctly extractsreasonEnumfrom the assignment reason array${t(category)}: ${details}formatgetAssignmentReasonCategoryappears to be imported twice inRegularBookingService.ts- verify this doesn't cause issuesRequested by: @joeauyeung
Link to Devin run: https://app.devin.ai/sessions/9abb95b7a90f496c90a47a51b7f52c0e