Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: Add rerouting to AssignmentReasonRecorder #19252

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

Merged
merged 18 commits into from
Jun 27, 2025

Conversation

joeauyeung
Copy link
Contributor

@joeauyeung joeauyeung commented Feb 12, 2025

What does this PR do?

  • When booking is rerouted we record the assignment reason

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.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Create a routed booking
  • Reroute the booking
    • Assignment reason should be recorded

@joeauyeung joeauyeung requested a review from a team as a code owner February 12, 2025 04:54
@graphite-app graphite-app bot requested a review from a team February 12, 2025 04:55
@keithwillcode keithwillcode added consumer core area: core, team members only labels Feb 12, 2025
@dosubot dosubot bot added bookings area: bookings, availability, timezones, double booking ✨ feature New feature or request labels Feb 12, 2025
Copy link

graphite-app bot commented Feb 12, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (02/12/25)

1 reviewer was added to this PR based on Keith Williams's automation.

Copy link

vercel bot commented Feb 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cal-com-ui-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 26, 2025 5:42am
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Jun 26, 2025 5:42am
cal-eu ⬜️ Ignored (Inspect) Visit Preview Jun 26, 2025 5:42am
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Jun 26, 2025 5:42am

@@ -467,6 +469,7 @@ const NewRoutingManager = ({
// TODO: Long term, we should refactor handleNewBooking and use a different route specific for this purpose,
createBookingMutation.mutate({
rescheduleUid: booking.uid,
rescheduledBy: session?.data?.user?.email,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to track who is calling the reroute

Comment on lines +16 to +17
isRerouting,
reroutedByEmail,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can reuse the logic that we use when recording the initial routing. That way we can see what attributes changed.

Copy link
Contributor

This PR is being marked as stale due to inactivity.

@github-actions github-actions bot added the Stale label Apr 16, 2025
@github-actions github-actions bot removed the Stale label Apr 25, 2025
@@ -469,6 +471,7 @@ const NewRoutingManager = ({
// TODO: Long term, we should refactor handleNewBooking and use a different route specific for this purpose,
createBookingMutation.mutate({
rescheduleUid: booking.uid,
rescheduledBy: session?.data?.user?.email ?? undefined,
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we error early if session is nullish, because rerouting can't be done by a non-logged in user.

Doing this change make it feel like non-logged in user could do re-routing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A non-logged in user would never see this dialog because we only show this for authed users who have access to make the reroute. The typing just makes this undefined.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, but if he is never supposed to see this dialog, then I think we should make it explict and check for session the first thing in the component(after all the hooks) and early return.

Then we could just do session.data.user.email here. It avoids the entire component to keep executing in such a case.

Copy link
Member

@hariombalhara hariombalhara left a comment

Choose a reason for hiding this comment

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

Left some comments, overall looks good.

Also, CI is failing a lot of checks

@vercel vercel bot temporarily deployed to Preview – api May 9, 2025 19:33 Inactive
@vercel vercel bot temporarily deployed to Preview – cal May 9, 2025 19:33 Inactive
@keithwillcode keithwillcode added the enterprise area: enterprise, audit log, organisation, SAML, SSO label May 9, 2025
@vercel vercel bot temporarily deployed to Preview – cal May 9, 2025 19:37 Inactive
@vercel vercel bot temporarily deployed to Preview – api May 9, 2025 19:37 Inactive
Copy link

delve-auditor bot commented Jun 26, 2025

No security or compliance issues detected. Reviewed everything up to c63d274.

Security Overview
  • 🔎 Scanned files: 4 changed file(s)
Detected Code Changes
Change Type Relevant files
Bug Fix ► RerouteDialog.tsx
    Add rescheduledBy email for new tab rescheduling
► RerouteDialog.test.tsx
    Update tests to include session context
► handleNewBooking.ts
    Pass rescheduling information to assignment recorder
► AssignmentReasonRecorder.ts
    Add support for rerouted assignment reason

Reply to this PR with @delve-auditor followed by a description of what change you want and we'll auto-submit a change to this PR to implement it.

@vercel vercel bot temporarily deployed to Preview – api June 26, 2025 05:41 Inactive
Copy link
Member

@hariombalhara hariombalhara left a comment

Choose a reason for hiding this comment

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

@joeauyeung Some conflicts were there, I resolved them. Please take a look

Also, we weren't passing rescheduledBy when doing the Rerouting through new tab(with different timeslot option), have fixed that as well. Corresponding commit c63d274

I tested and LGTM !!

Copy link
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

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

LGTM!

@emrysal emrysal merged commit 02ef4db into main Jun 27, 2025
41 checks passed
@emrysal emrysal deleted the add-rerouted-assignment-handler branch June 27, 2025 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bookings area: bookings, availability, timezones, double booking consumer core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO ✨ feature New feature or request ready-for-e2e routing-forms area: routing forms, routing, forms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants