fix: Hide 'Create New' button when user has no creation permissions#41334
fix: Hide 'Create New' button when user has no creation permissions#41334prathamesh04 wants to merge 2 commits into
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
🦋 Changeset detectedLatest commit: 8a2a13e The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js}📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
Files:
🧠 Learnings (6)📚 Learning: 2026-02-10T16:32:42.586ZApplied to files:
📚 Learning: 2026-05-11T20:30:35.265ZApplied to files:
📚 Learning: 2026-02-26T19:25:44.063ZApplied to files:
📚 Learning: 2026-02-26T19:25:44.063ZApplied to files:
📚 Learning: 2026-05-06T12:21:44.083ZApplied to files:
📚 Learning: 2026-03-16T21:50:37.589ZApplied to files:
🔇 Additional comments (2)
WalkthroughThe create-new menu now filters out empty sections and returns ChangesCreate menu visibility
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
- Fix useCreateNewMenu to filter sections by items.length instead of a broad permission check that always includes create-d - Remove unused permission field from GenericMenu sections type - Return null from NavBarItemCreateNew when sections are empty - Add changeset
|
Hi @tassoevan @juliajforesti @dougfabris — this PR fixes the issue where the "Create New" button stays visible even when a user has zero creation permissions. The root cause was that used a broad permission check (including I've attached a video walkthrough demonstrating the fix locally. Happy to address any feedback! Screencast.from.2026-07-13.16-14-48.webm |
Issue
Fixes #40731
Description
When a user has no permissions to create any resources (channel, team, discussion, DM), the "Create New" button in the sidebar navbar was still being rendered in a disabled state, causing unnecessary UI clutter.
Changes
NavBarItemCreateNew.tsxto rendernullwhen the sections array is emptyHow to test
Summary by CodeRabbit