fix(react): validate role count limit on member invitations - #387
fix(react): validate role count limit on member invitations#387grandmaester wants to merge 1 commit into
Conversation
0442a73 to
a8d8635
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #387 +/- ##
==========================================
- Coverage 88.20% 88.19% -0.02%
==========================================
Files 199 199
Lines 16978 16999 +21
Branches 1826 2219 +393
==========================================
+ Hits 14976 14992 +16
- Misses 2002 2007 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Tip For best results, initiate chat on the files or code changes. The PR description image shows a browser window at
This matches the PR's described behavior: selecting more than 10 roles in the Invite Member modal triggers the "max roles" validation error toast while the modal stays open.
Just let me know and I'll dig in. |
Summary
Adds the missing "max roles per request" validation to the member invitation create flow, so inviting a member with more than the allowed number of roles is blocked client-side and surfaces an error toast instead of silently failing.
Why
The Invite Member modal allowed selecting more than the maximum number of roles per request. The role-count limit was already enforced in the member-detail role assignment flow (
validateRequestRoleForMember), but the invitation create flow had no equivalent guard. As a result a user could select e.g. 11+ roles and submit, with no proper validation gating the request.What
createInvitationMutationusing the existingvalidateRequestRoleForMemberhelper (withassign = true), matching member-detail behavior.abortedresult when validation fails, so the API call is not made and the success path (onAfter, success toast) is skipped.abortedresult throughhandleCreateSubmitso the Invite Member modal stays open when the limit is exceeded (instead of closing).createInvitationMutationresult type toMemberInvitation | { aborted: true } | undefined.Packages
packages/corepackages/reactexamplesReferences
When more than the allowed number of roles is selected, the error toast "You can only assign a maximum of 10 roles at a time." is shown and the modal remains open:
Testing
How can this be verified? Note anything intentionally not covered by tests and why.
Checklist
Contributing