Skip to content
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

P2: Add pre-approved domains setting for hubs #57227

Merged
merged 29 commits into from
Nov 24, 2021

Conversation

annemirasol
Copy link
Contributor

@annemirasol annemirasol commented Oct 21, 2021

Changes proposed in this Pull Request

  • Adds a new setting to P2 hubs for controlling pre-approved domains
  • This is part of a new P2 feature that will allow users with specific email domains to join a P2 on their own (no need for invites).

Testing instructions

  • Only P2 hubs should have this setting available.
  • Validation should work as expected. Rejected domains should display why they are rejected.
  • Saving and loading should work as expected.

Screens

Screen Shot 2021-10-27 at 7 03 37 PM

Screen Shot 2021-10-27 at 7 04 04 PM

Related to 3887-gh-Automattic/p2

@github-actions
Copy link

github-actions bot commented Oct 21, 2021

@matticbot
Copy link
Contributor

matticbot commented Oct 21, 2021

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~79 bytes added 📈 [gzipped])

name                   parsed_size           gzip_size
entry-main                  +197 B  (+0.0%)      +79 B  (+0.0%)
entry-login                 +126 B  (+0.0%)      +46 B  (+0.0%)
entry-gutenboarding         +126 B  (+0.0%)      +46 B  (+0.0%)
entry-domains-landing       +126 B  (+0.0%)      +46 B  (+0.0%)
entry-browsehappy           +126 B  (+0.1%)      +46 B  (+0.2%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Sections (~4018 bytes added 📈 [gzipped])

name      parsed_size           gzip_size
settings     +15149 B  (+2.5%)    +4018 B  (+2.2%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~164 bytes removed 📉 [gzipped])

name                                        parsed_size           gzip_size
async-load-calypso-post-editor-media-modal       -737 B  (-0.0%)     -164 B  (-0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

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.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@annemirasol annemirasol force-pushed the add/p2-setting-preapproved-domain branch from 97bcac6 to 2663576 Compare October 22, 2021 08:23
@annemirasol annemirasol force-pushed the add/p2-setting-preapproved-domain branch 2 times, most recently from 0960490 to 0aafb59 Compare November 2, 2021 11:22
@annemirasol annemirasol marked this pull request as ready for review November 2, 2021 12:04
@annemirasol annemirasol requested a review from a team November 2, 2021 12:04
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Nov 2, 2021
@annemirasol annemirasol force-pushed the add/p2-setting-preapproved-domain branch from 743ddfb to fd8bd23 Compare November 6, 2021 08:17
Copy link
Member

@naxoc naxoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good! I tested locally and it works great.

I added a couple of small non-blocking comments :)

Copy link
Contributor

@lamosty lamosty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, Anne!

Left a few comments.

config/wpcalypso.json Outdated Show resolved Hide resolved
@@ -1,15 +1,27 @@
import config from '@automattic/calypso-config';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: you could also import just isEnabled like import { isEnabled } from ....

checked={ isToggledOn }
disabled={ isRequestingSettings || isSavingSettings }
onChange={ handleDomainsToggle }
label={ translate(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if the second param is missing here (the text domain).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one does not have a text domain param.

import { getSelectedSiteId } from 'calypso/state/ui/selectors';
import wrapSettingsForm from '../wrap-settings-form';

const P2PreapprovedDomainsForm = ( props ) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe subjective: do you think we could move most of the smaller helpers out of the component body? Would make scanning P2PreapprovedDomainsForm a bit easier. In the past, we used to have stateful, class based React components. Methods there were easy to spot or scan. Not sure about these const components, though. I always worked only with small ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm gonna keep them inside the component as many of them use stuff from state. For consistency, I'll keep them all together.

@annemirasol annemirasol requested review from naxoc, lamosty and a team November 15, 2021 11:29
Copy link
Contributor

@unDemian unDemian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great! 🎩

@unDemian unDemian added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Nov 23, 2021
@annemirasol annemirasol force-pushed the add/p2-setting-preapproved-domain branch from 9ed9712 to 4d42b87 Compare November 24, 2021 13:19
@annemirasol annemirasol merged commit 378c32d into trunk Nov 24, 2021
@annemirasol annemirasol deleted the add/p2-setting-preapproved-domain branch November 24, 2021 13:30
@a8ci18n
Copy link

a8ci18n commented Nov 24, 2021

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/6991483

Thank you @annemirasol for including a screenshot in the description! This is really helpful for our translators.

@a8ci18n
Copy link

a8ci18n commented Dec 2, 2021

Translation for this Pull Request has now been finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants