Skip to content

[WEB-4629] Show 2FA banner on first workspace load after accepting invite#1972

Open
clintonium-119 wants to merge 1 commit into
feat/blip-2fafrom
WEB-4629-banner-display-fix
Open

[WEB-4629] Show 2FA banner on first workspace load after accepting invite#1972
clintonium-119 wants to merge 1 commit into
feat/blip-2fafrom
WEB-4629-banner-display-fix

Conversation

@clintonium-119

@clintonium-119 clintonium-119 commented Jul 3, 2026

Copy link
Copy Markdown
Member

Small fix for an issue that was noticed for WEB-4629

After accepting a clinician invite, getClinicsForClinician seeds clinic.clinicians with only the viewer's own record. An admin viewer therefore looked like the sole admin, so the banner's sole-admin exemption suppressed the "Set Up 2FA" banner until a navigation round-trip reloaded the full roster.

To fix, we fetch the full clinician roster via a skip-gated RTK Query hook when the partial data makes the viewer appear to be the sole admin, and count admins from the fetched roster. The exemption is then decided on complete data and the banner renders on first load.

After accepting a clinician invite, getClinicsForClinician seeds
clinic.clinicians with only the viewer's own record. An admin viewer
therefore looked like the sole admin, so the banner's sole-admin
exemption suppressed the "Set Up 2FA" banner until a navigation
round-trip reloaded the full roster.

Fetch the full clinician roster via a skip-gated RTK Query hook when
the partial data makes the viewer appear to be the sole admin, and
count admins from the fetched roster. The exemption is then decided on
complete data and the banner renders on first load.

The gate reads the partial count from state.blip, not the query cache,
so resolving the query does not flip skip and cannot loop. Add the
cliniciansApi mock to the suites that render the app-wide provider.
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (4)
  • master
  • main
  • develop
  • release.*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bd8795d3-1508-4a86-929f-08d84d246288

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch WEB-4629-banner-display-fix

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

@clintonium-119 clintonium-119 requested a review from henry-tp July 3, 2026 22:08

// Stubs the RTK Query hook for suites on redux-mock-store (no api middleware). Defaults to no
// data; override per-test with useGetCliniciansForClinicQuery.mockReturnValue({ data }).
export const useGetCliniciansForClinicQuery = jest.fn(() => ({ data: undefined }));

@henry-tp henry-tp Jul 6, 2026

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.

I don't think this is used anywhere; should be able to delete the file?

jest.mock('../../../../../app/redux/features/mfaStatus/mfaStatusApi');
import { useGetMfaStatusQuery } from '../../../../../app/redux/features/mfaStatus/mfaStatusApi';
jest.mock('../../../../../app/redux/features/clinicians/cliniciansApi');
import { useGetCliniciansForClinicQuery } from '../../../../../app/redux/features/clinicians/cliniciansApi';

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.

We can do this for now since this is just for the hotfix, but in the future we should start switching to msw instead of mocking

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.

2 participants