-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PM-13755] Decouple Invite and Edit User Flows #12277
base: main
Are you sure you want to change the base?
[PM-13755] Decouple Invite and Edit User Flows #12277
Conversation
Great job, no security vulnerabilities found in this Pull Request |
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #12277 +/- ##
==========================================
+ Coverage 34.96% 34.97% +0.01%
==========================================
Files 2976 2977 +1
Lines 90585 90618 +33
Branches 16980 16974 -6
==========================================
+ Hits 31671 31694 +23
- Misses 56457 56467 +10
Partials 2457 2457 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All makes sense to me! Minor feedback only.
Also note your Jira ticket link is wrong.
.../app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts
Outdated
Show resolved
Hide resolved
.../app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts
Outdated
Show resolved
Hide resolved
.../app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts
Outdated
Show resolved
Hide resolved
apps/web/src/app/admin-console/organizations/members/members.component.ts
Outdated
Show resolved
Hide resolved
apps/web/src/app/admin-console/organizations/members/members.component.ts
Outdated
Show resolved
Hide resolved
apps/web/src/app/admin-console/organizations/members/members.component.ts
Show resolved
Hide resolved
apps/web/src/app/admin-console/organizations/members/members.component.ts
Show resolved
Hide resolved
Sanity test for email validator |
...rganizations/members/components/member-dialog/validators/org-seat-limit-reached.validator.ts
Outdated
Show resolved
Hide resolved
...rganizations/members/components/member-dialog/validators/org-seat-limit-reached.validator.ts
Outdated
Show resolved
Hide resolved
...zations/members/components/member-dialog/validators/org-seat-limit-reached.validator.spec.ts
Show resolved
Hide resolved
...zations/members/components/member-dialog/validators/org-seat-limit-reached.validator.spec.ts
Outdated
Show resolved
Hide resolved
...zations/members/components/member-dialog/validators/org-seat-limit-reached.validator.spec.ts
Outdated
Show resolved
Hide resolved
...zations/members/components/member-dialog/validators/org-seat-limit-reached.validator.spec.ts
Outdated
Show resolved
Hide resolved
...zations/members/components/member-dialog/validators/org-seat-limit-reached.validator.spec.ts
Outdated
Show resolved
Hide resolved
...zations/members/components/member-dialog/validators/org-seat-limit-reached.validator.spec.ts
Outdated
Show resolved
Hide resolved
...zations/members/components/member-dialog/validators/org-seat-limit-reached.validator.spec.ts
Show resolved
Hide resolved
private async handleInviteUsers(userView: OrganizationUserAdminView, organization: Organization) { | ||
const emails = [...new Set(this.formGroup.value.emails.trim().split(/\s*,\s*/))]; | ||
|
||
this.setInputEmailCountValidator(organization, emails.length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validators should be attached when the form is first initialized, so that the user gets immediate feedback when filling it out. You should delete setInputEmailCountValidator
and attach your validator in the existing setFormValidators
method.
Testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also have some failures caused by strict typechecking: https://github.com/bitwarden/clients/actions/runs/12283466303/job/34277004841
It's a bit premature to start solving these, I suggest adding the magic comment to the top of the offending files:
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
.../app/admin-console/organizations/members/components/member-dialog/member-dialog.component.ts
Outdated
Show resolved
Hide resolved
I was looking at this yesterday. The only thing that I'm confused about is that this isn't my change. I guess the type check goes through the whole code repo or code paths? Either way, I'm going to do what you suggested. |
Testing Code review 3 Edit: This testing includes both validators; |
You're right - my bad. This lgtm! |
I will do some manual testing after the pipeline succeeds. |
I did some regression tests for the Free and the family tiers to make sure my changes and Brandon's changes are both working. Family.tier.testing.movFree.tier.testing.mov |
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-13755
📔 Objective
Refactor the code to separate the invite and edit user flows, improving readability by reducing conditional complexity and decoupling responsibilities.
For members.component.ts
invite
method and move all the invite user flow fromedit
method into it.For member-dialog.component.ts
handleEditUser
,handleInviteUsers
, andgetUserView
.submit
method as form validation prevents this code from being executed. DiscussionNo new visible behavior was introduced.
📸 Screenshots
Tested by going through invite, edit, revoke, and remove
Regression.testing.webm
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes