Skip to content

Comments

fix: bring back correct routing form teams#24158

Merged
sean-brydon merged 1 commit intomainfrom
fix/get-correct-routing-form-create-teams
Sep 30, 2025
Merged

fix: bring back correct routing form teams#24158
sean-brydon merged 1 commit intomainfrom
fix/get-correct-routing-form-create-teams

Conversation

@sean-brydon
Copy link
Member

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)

CleanShot 2025-09-30 at 08 56 07

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

@graphite-app graphite-app bot requested a review from a team September 30, 2025 07:56
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 30, 2025

Walkthrough

Adds 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)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly captures the primary change by indicating that the fix restores the correct teams for routing form creation, which aligns with the code changes focused on permission and role adjustments for team listing.
Description Check ✅ Passed The description clearly explains that the PR fixes the issue with PBAC and team visibility when creating routing forms and provides context and testing steps that directly relate to the code changes.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/get-correct-routing-form-create-teams

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
🧪 Early access (Sonnet 4.5): enabled

We 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:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

Comment @coderabbitai help to get the list of available commands and usage tips.

@keithwillcode keithwillcode added consumer core area: core, team members only labels Sep 30, 2025
@dosubot dosubot bot added routing-forms area: routing forms, routing, forms 🐛 bug Something isn't working labels Sep 30, 2025
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.

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/web/app/(use-page-wrapper)/apps/routing-forms/forms/[[...pages]]/Forms.tsx (1)

314-322: Use t() 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.

📥 Commits

Reviewing files that changed from the base of the PR and between ccd7fdf and 574b3fb.

📒 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
The withPermission prop is correctly defined on CreateButtonWithTeamsList and propagated to teamsAndUserProfilesQuery.useQuery with the intended permission and fallbackRoles.

@github-actions
Copy link
Contributor

E2E results are ready!

@sean-brydon sean-brydon merged commit 2dfb82b into main Sep 30, 2025
99 of 106 checks passed
@sean-brydon sean-brydon deleted the fix/get-correct-routing-form-create-teams branch September 30, 2025 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working consumer core area: core, team members only ready-for-e2e routing-forms area: routing forms, routing, forms size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants