fix(opportunities): hide checkboxes + action bar for viewer role#876
Conversation
Viewer role has no purchase/plan actions; the Select-all and per-row checkboxes were misleading. Now hidden for role=viewer; admin/operator render unchanged. Closes #869.
|
Warning Review limit reached
More reviews will be available in 11 minutes and 41 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR adds permission-based gating to the recommendations table's selection UI. Viewer/readonly sessions now render without checkboxes or row-click selection affordances by introducing a ChangesReadonly Selection UI Gating
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@frontend/src/__tests__/recommendations-permissions.test.ts`:
- Around line 86-101: Add a new readonly unit test that exercises
grouped-row/multi-variant rendering by creating a fixture with two variant
objects that share the same cell key (e.g., clone sampleRec twice with different
variant identifiers but identical cell key), render the recommendations
component/table in readonly mode (use the same test helpers used elsewhere in
this file), and assert that the header and body column counts remain equal and
that no extra leading checkbox column is rendered (i.e., verify
header.columns.length === body.row.columns.length and there is no checkbox
column at index 0). Place this alongside the existing single-row tests (also
update tests covering lines ~160-225 similarly) so grouped-row rendering is
covered.
In `@frontend/src/recommendations.ts`:
- Around line 2483-2484: The summary rows for multi-variant/grouped displays
still emit a leading <td class="checkbox-col"> even when the showCheckboxes
parameter is false, causing column misalignment; update the rendering logic
wherever summary/group rows are built (the function that accepts the
showCheckboxes parameter) to conditionally include that checkbox/chevron <td>
only when showCheckboxes === true—apply the same fix to the other occurrences
mentioned (around the blocks at the ranges you noted) so header and all row
types stay aligned.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: ac6b46bc-8a14-419d-9db9-4405618357ed
📒 Files selected for processing (2)
frontend/src/__tests__/recommendations-permissions.test.tsfrontend/src/recommendations.ts
- Conditionally render checkbox-col td in multi-variant summary rows only when showCheckboxes is true (viewer role fix); inline chevron button into rec-cell-identity span when showCheckboxes is false so expand/collapse remains accessible without the extra column. - Add grouped-row readonly and admin tests that assert no checkbox-col td in viewer mode and correct effective column alignment via colSpan.
|
Addressed both CR findings in 88eacb9. @coderabbitai review |
|
✅ Actions performedReview triggered.
|
Summary
QA Viewer Role 2.3 + 2.4: Viewer role users could click rows on the Opportunities table and toggle per-row + Select-all checkboxes, even though Viewer has no purchase/plan actions. The checkboxes were misleading affordances.
Fix
For
role === 'viewer':Admin/operator roles unchanged.
Files changed
frontend/src/recommendations.tsfrontend/src/__tests__/recommendations-permissions.test.tsTest plan
Closes #869.
Summary by CodeRabbit
New Features
Tests