-
Notifications
You must be signed in to change notification settings - Fork 2k
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
SSO: Add invite user button option #88369
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~1375 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
components: { | ||
a: ( | ||
<a | ||
href="https://jetpack.com/support/sso/" |
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.
Let's use localizeUrl
here
{ email_or_username: email as string, role: userRoles }, | ||
] ) ) as [ sendInvitesResponse ]; | ||
|
||
const success = response && response[ 0 ].success; |
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.
Can add safety checks here?
Also we need to manage errors, and maybe log the invite error event. WDYT?
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.
For sure! It is coming in the next commit. :)
Addressed 👍
deletingInvite, | ||
} ) => { | ||
const translate = useTranslate(); | ||
const { isPending } = invite; | ||
|
||
if ( invite && inviteWasDeleted ) { |
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.
Hi @agrullon95 To keep the pending list up to date, I had to remove this logic added by you in #86927. Could you please help me to test and make sure it is still working well?
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.
I don't recall why I added that there, but I didn't notice any issues with invitations/revokes when testing.
requestingResend, | ||
resendSuccess, | ||
inviteWasDeleted, | ||
deletingInvite, | ||
} = this.props; | ||
|
||
if ( ! site || ! site.ID || deleteSuccess ) { |
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.
@agrullon95 same here
) | ||
); | ||
} | ||
const success = response && response[ 0 ]?.success; |
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.
Does it work if we do
const success = response?.[0]?.success;
?
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.
Yes, wouldn't it be the same? Personally, I read better like it is now.
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.
Your call 👍
const siteId = site?.ID as number; | ||
|
||
const pendingInvites = useSelector( ( state ) => getPendingInvitesForSite( state, siteId ) ); | ||
const pendingInvitesMails = pendingInvites?.map( ( invite ) => invite.user?.email ); |
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.
Lets rename to pendingInvitesEmails
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.
Thanks
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.
Tested inviting a new user via Calypso and accepting the invitation.
Also tested inviting a new user via Calypso, creating the same user via /wp-admin
and accepting the invite.
Cool, let's fix the unit test and then this should be good to go 👍 |
@@ -150,11 +150,6 @@ describe( 'PeopleInviteDetails', () => { | |||
expect( mockGoBack ).toHaveBeenCalledTimes( 1 ); | |||
expect( mockGoBack ).toHaveBeenCalledWith( '/people/invites/' + siteObject.slug ); | |||
|
|||
// Verify that a placeholder is rendered while waiting for `page.back` |
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.
Since we are refreshing the list again after revoking or inviting, we don't need this placeholder anymore.
The Placeholder was causing issues when revoking and inviting again the same user.
This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/11603794 Some locales (Hebrew, Japanese) have been temporarily machine-translated due to translator availability. All other translations are usually ready within a few days. Untranslated and machine-translated strings will be sent for translation next Monday and are expected to be completed by the following Friday. Thank you @renancarvalho for including a screenshot in the description! This is really helpful for our translators. |
Translation for this Pull Request has now been finished. |
* Add invite button option * Fix type * Remove unnecessary comment * Add notice and style * Use LocalizeUrl * Fix small viewport message style * Fix pending invites not being shown sometimes * Add error handling * Use correct icon * Rename variable * Remove unnecessary test expectation
Related to #
Proposed Changes
Testing Instructions
Pre-merge Checklist