Skip to content

[fix] Group switch modal: prefill availability form with the registration email, not the account email#2816

Merged
Will-Howard merged 2 commits into
masterfrom
wh-2811-group-switch-registration-email
Jul 21, 2026
Merged

[fix] Group switch modal: prefill availability form with the registration email, not the account email#2816
Will-Howard merged 2 commits into
masterfrom
wh-2811-group-switch-registration-email

Conversation

@Will-Howard

Copy link
Copy Markdown
Collaborator

Description

Per the issue description, this is needed to ensure that the link to submit availability goes to the right place after we support changing account emails (#2570)

Issue

Fixes #2811

Developer checklist

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Will-Howard, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 42 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4be1566a-bb2e-4d59-9223-190c5250e9bb

📥 Commits

Reviewing files that changed from the base of the PR and between 68321de and 186c3d7.

📒 Files selected for processing (2)
  • apps/website/src/components/courses/GroupSwitchModal.test.tsx
  • apps/website/src/components/courses/GroupSwitchModal.tsx
📝 Walkthrough

Walkthrough

Updated GroupSwitchModal to render the availability update link from courseRegistration.email and courseRegistration.roundId. Extended the test setup with a mocked course registration and added an assertion that the manual switch flow includes the registration email in the link URL.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: using the registration email for the availability form link.
Description check ✅ Passed The description covers the motivation, linked issue, and checklist, and is complete enough for this PR.
Linked Issues check ✅ Passed The code change matches #2811 by keeping the availability form aligned with changing user emails.
Out of Scope Changes check ✅ Passed The changes stay focused on the group switch modal and its tests, with no unrelated edits.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch wh-2811-group-switch-registration-email

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.

@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR prefills the group-switch availability form with the course registration email.

  • Uses courseRegistration.email instead of the current account email.
  • Adds a registration query mock and URL assertion to the modal test.

Confidence Score: 4/5

The missing-registration path needs a fix before merging.

  • The intended registration email is used when the query succeeds.
  • A failed or empty registration query leaves the required availability step visible without its action link.

apps/website/src/components/courses/GroupSwitchModal.tsx

Important Files Changed

Filename Overview
apps/website/src/components/courses/GroupSwitchModal.tsx Uses the registration email correctly, but hides the required availability link when registration data is unavailable.
apps/website/src/components/courses/GroupSwitchModal.test.tsx Verifies that the generated availability URL contains the encoded registration email.

Reviews (1): Last reviewed commit: "[fix] Group switch modal: prefill availa..." | Re-trigger Greptile

isVisible: !!user && isManualRequest,
title: 'Update availability (required)',
subtitle: user ? (
subtitle: courseRegistration ? (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Required Link Disappears Without Registration

When the registration query fails or returns no accepted registration, the manual-request section remains visible but this condition removes the required availability link. The user can still see and confirm the update checkbox without being given a way to perform the update.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/website/src/components/courses/GroupSwitchModal.tsx`:
- Around line 358-367: Update the availability section rendering and its
loading/readiness condition in GroupSwitchModal so it requires
courseRegistration, not merely user. Ensure the required checkbox and
availability link become visible together only after courseRegistration is
available, preventing submission before the link can be used.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 34dc89a2-976a-4f97-a6be-8729d8e1d7f4

📥 Commits

Reviewing files that changed from the base of the PR and between d1fdc32 and 68321de.

📒 Files selected for processing (2)
  • apps/website/src/components/courses/GroupSwitchModal.test.tsx
  • apps/website/src/components/courses/GroupSwitchModal.tsx

Comment on lines +358 to +367
subtitle: courseRegistration ? (
<>
To help us assign you to a group which best suits you, {' '}
<a
href={buildAvailabilityFormUrl({
email: user.email,
email: courseRegistration.email,
utmSource: 'bluedot-group-switch-modal',
courseRegistration,
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
roundId: courseRegistration?.roundId || '',
roundId: courseRegistration.roundId || '',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Keep the availability section gated by registration readiness.

Line [356] still makes the required section visible when user exists, while this changed block omits the link until courseRegistration is available. Because that query is excluded from isLoading, users can see the checkbox with no link and submit without updating availability. Gate the section and/or loading state on courseRegistration so the required link and checkbox appear together.

Suggested fix
-  const { data: courseRegistration } = trpc.courseRegistrations.getByCourseId.useQuery(
+  const { data: courseRegistration, isLoading: isCourseRegistrationLoading } = trpc.courseRegistrations.getByCourseId.useQuery(

-  const isLoading = isCourseLoading || isDiscussionsLoading;
+  const isLoading = isCourseLoading || isDiscussionsLoading || isCourseRegistrationLoading;

-      isVisible: !!user && isManualRequest,
+      isVisible: !!courseRegistration && isManualRequest,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/website/src/components/courses/GroupSwitchModal.tsx` around lines 358 -
367, Update the availability section rendering and its loading/readiness
condition in GroupSwitchModal so it requires courseRegistration, not merely
user. Ensure the required checkbox and availability link become visible together
only after courseRegistration is available, preventing submission before the
link can be used.

…ng state and fall back to the account email, so the required availability link always renders
@Will-Howard
Will-Howard temporarily deployed to wh-2811-group-switch-registration-email - bluedot-preview PR #2816 July 21, 2026 18:11 — with Render Destroyed
@Will-Howard
Will-Howard temporarily deployed to wh-2811-group-switch-registration-email - bluedot-storybook-preview PR #2816 July 21, 2026 18:11 — with Render Destroyed
@Will-Howard
Will-Howard merged commit 5bb67fa into master Jul 21, 2026
7 checks passed
@Will-Howard
Will-Howard deleted the wh-2811-group-switch-registration-email branch July 21, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure the availability form handles potentially changing emails

1 participant