Skip to content

Place permission guards in Language Overview#1777

Merged
rdonigian merged 1 commit intodevelopfrom
language-permissions
Mar 4, 2026
Merged

Place permission guards in Language Overview#1777
rdonigian merged 1 commit intodevelopfrom
language-permissions

Conversation

@rdonigian
Copy link
Contributor

No description provided.

@rdonigian rdonigian requested a review from a team as a code owner March 4, 2026 14:14
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 4, 2026

Warning

Rate limit exceeded

@rdonigian has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 16 minutes and 12 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8c955ec9-315c-4575-8a1e-1d86a9171aa5

📥 Commits

Reviewing files that changed from the base of the PR and between 4d88872 and afada1e.

📒 Files selected for processing (1)
  • src/components/posts/PostList.tsx
📝 Walkthrough

Walkthrough

Two UI components are updated to conditionally render floating action buttons (FABs) based on permission flags. The Add Post FAB in PostList and the Add Location FAB in LanguageDetail are now only rendered when the respective canCreate flags are truthy, rather than always rendering.

Changes

Cohort / File(s) Summary
Conditional FAB Rendering
src/components/posts/PostList.tsx, src/scenes/Languages/Detail/LanguageDetail.tsx
Both files introduce permission-based conditional rendering for their respective FABs. The Add Post and Add Location buttons now only render to the DOM when the canCreate flag is truthy, replacing previous unconditional rendering patterns.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions 'Language Overview' but changes are in PostList and LanguageDetail components, making it overly specific to one file. Revise title to reflect that permission guards are being added across multiple components, not just Language Overview.
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to evaluate relevance to the changeset. Add a description explaining the permission guard changes and their purpose, even if brief.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch language-permissions

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/scenes/Languages/Detail/LanguageDetail.tsx (1)

245-247: Remove redundant className guard inside an already guarded branch.

Since Line 239 already checks locations?.canCreate, the ternary on Lines 245-247 is always undefined in this branch.

♻️ Suggested cleanup
                 <Tooltip title="Add location">
                   <Fab
                     color="error"
                     aria-label="add location"
-                    className={
-                      locations.canCreate ? undefined : classes.hidden
-                    }
                     onClick={addLocation}
                   >
                     <Add />
                   </Fab>
                 </Tooltip>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/scenes/Languages/Detail/LanguageDetail.tsx` around lines 245 - 247, In
the block inside LanguageDetail.tsx where you already gate the branch with
locations?.canCreate, remove the redundant ternary on the element's className
(the expression "locations.canCreate ? undefined : classes.hidden") because it's
always undefined in this branch; simply omit the className prop or set it to the
intended static value instead, locating the element that currently references
locations.canCreate and classes.hidden to make the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/scenes/Languages/Detail/LanguageDetail.tsx`:
- Around line 245-247: In the block inside LanguageDetail.tsx where you already
gate the branch with locations?.canCreate, remove the redundant ternary on the
element's className (the expression "locations.canCreate ? undefined :
classes.hidden") because it's always undefined in this branch; simply omit the
className prop or set it to the intended static value instead, locating the
element that currently references locations.canCreate and classes.hidden to make
the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 74e834dd-8bd2-48f6-b51a-51e0c17466f8

📥 Commits

Reviewing files that changed from the base of the PR and between a906909 and 4d88872.

📒 Files selected for processing (2)
  • src/components/posts/PostList.tsx
  • src/scenes/Languages/Detail/LanguageDetail.tsx

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a permission guard to the posts “Add Post” action so users without create permission don’t see the create affordance in the UI (used by Language/Partner/Project post lists).

Changes:

  • Read canCreate from the list query result (rest.data?.canCreate).
  • Hide the “Add Post” FAB when canCreate is falsy via sx={{ visibility: ... }}.

You can also share your feedback on Copilot code review. Take the survey.

@rdonigian rdonigian merged commit e9f8619 into develop Mar 4, 2026
12 checks passed
@rdonigian rdonigian deleted the language-permissions branch March 4, 2026 14:40
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.

3 participants