Repository navigation
fix(ux): show account display name in Opportunities for non-admin users - #1434
Conversation
…rs (#1419) Switch loadRecommendations() from api.listAccounts() to api.listAccountsMinimal() to populate the accountNamesCache. listAccounts() calls GET /api/accounts which requires the admin view:accounts permission; non-admin users receive a 403, .catch(()=>[]) silences it, the cache stays empty, and every row falls back to showing the raw account UUID. listAccountsMinimal() calls GET /api/accounts/list which is gated on view:recommendations — the same permission that governs the whole Opportunities page — so standard users can resolve account names just like admin users. Add tests verifying listAccountsMinimal is called (not listAccounts), that the display name appears in the rendered row, and that the raw ID is still used as a fallback when no matching entry is found. Closes #1419
|
@coderabbitai review |
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
✅ Action performedReview finished.
|
#1419) The #1419 fix switched loadRecommendations() to api.listAccountsMinimal(), but three sibling test suites mock ../api with listAccounts only. Without a listAccountsMinimal stub the call returns undefined, loadRecommendations throws before the toolbar/buttons render, and 38 assertions fail under the full jest run (CI Frontend/Unit). Add listAccountsMinimal: jest.fn().mockResolvedValue([]) to the ../api mock in recommendations-permissions, recommendations-enabled-providers, and recommendations-lookback so the full suite passes.
|
Fixed the failing sibling suites: added Full @coderabbitai review |
|
✅ Action performedReview finished.
|
|
Merged on the substantive CI signal (all Lint/Unit/Integration/Security/Build/E2E/Validate-Terraform green; only the non-blocking tflint pre-commit flake red) closes #1419. |
Summary
loadRecommendations()fromapi.listAccounts()toapi.listAccountsMinimal()inrecommendations.tslistAccounts()hitsGET /api/accounts(requires adminview:accounts); non-admin users get a 403,.catch(()=>[])silences it, theaccountNamesCachestays empty, and every row shows the raw account UUID instead of the display namelistAccountsMinimal()hitsGET /api/accounts/listwhich requires onlyview:recommendations- the same permission that gates the entire Opportunities page - so standard users get account names toolistAccountsMinimalis called (notlistAccounts), that the display name appears in the rendered row, and that the raw ID is still used as fallback when no matching account is foundCloses #1419