fix: bring back correct routing form teams#24158
Conversation
WalkthroughAdds MembershipRole import in apps/web/app/(use-page-wrapper)/apps/routing-forms/forms/[[...pages]]/Forms.tsx. Updates NewFormButton usage of CreateButtonWithTeamsList to include a withPermission prop configured with permission: "routingForm.create" and fallbackRoles: [MembershipRole.OWNER, MembershipRole.ADMIN]. No other behavioral or control-flow changes noted. Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
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. 🧪 Early access (Sonnet 4.5): enabledWe are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience. Note:
Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/web/app/(use-page-wrapper)/apps/routing-forms/forms/[[...pages]]/Forms.tsx (1)
314-322: Uset()for localizing user-facing text.The hardcoded strings "field", "fields", "route", "routes", "response", and "responses" should be localized using the
t()function for consistency with internationalization best practices.As per coding guidelines.
Apply this diff to localize the strings:
<div className="flex flex-wrap gap-1"> <Badge variant="gray" startIcon="menu"> - {fields.length} {fields.length === 1 ? "field" : "fields"} + {fields.length} {fields.length === 1 ? t("field") : t("fields")} </Badge> <Badge variant="gray" startIcon="git-merge"> - {userRoutes.length} {userRoutes.length === 1 ? "route" : "routes"} + {userRoutes.length} {userRoutes.length === 1 ? t("route") : t("routes")} </Badge> <Badge variant="gray" startIcon="message-circle"> {form._count.responses}{" "} - {form._count.responses === 1 ? "response" : "responses"} + {form._count.responses === 1 ? t("response") : t("responses")} </Badge> </div>
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
apps/web/app/(use-page-wrapper)/apps/routing-forms/forms/[[...pages]]/Forms.tsx(2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/review.mdc)
Always use
t()for text localization in frontend code; direct text embedding should trigger a warning
Files:
apps/web/app/(use-page-wrapper)/apps/routing-forms/forms/[[...pages]]/Forms.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/review.mdc)
Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js
.utc()in hot paths like loops
Files:
apps/web/app/(use-page-wrapper)/apps/routing-forms/forms/[[...pages]]/Forms.tsx
**/*.{ts,tsx,js,jsx}
⚙️ CodeRabbit configuration file
Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.
Files:
apps/web/app/(use-page-wrapper)/apps/routing-forms/forms/[[...pages]]/Forms.tsx
🧬 Code graph analysis (1)
apps/web/app/(use-page-wrapper)/apps/routing-forms/forms/[[...pages]]/Forms.tsx (1)
packages/platform/libraries/index.ts (1)
MembershipRole(34-34)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Install dependencies / Yarn install & cache
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (2)
apps/web/app/(use-page-wrapper)/apps/routing-forms/forms/[[...pages]]/Forms.tsx (2)
21-21: LGTM! Correct import for MembershipRole.The import is appropriately sourced from Prisma enums and used in the withPermission configuration below.
50-53: Approve permission-based access control for routing form creation
ThewithPermissionprop is correctly defined onCreateButtonWithTeamsListand propagated toteamsAndUserProfilesQuery.useQuerywith the intendedpermissionandfallbackRoles.
E2E results are ready! |
What does this PR do?
Fixes the issue where org admins/owners using pbac would not see the correct teams to create a routing form on when they have the organization scoped permission (all sub-teams)
How should this be tested?
Be in an org with pbac enable. Make yourself a member of sub-teams with no routing form permissions
Try create a routing form