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

Enabling Unsupported Block Editor for Jetpack sites with SSO enabled. #12606

Merged

Conversation

marecar3
Copy link
Contributor

@marecar3 marecar3 commented Aug 5, 2020

Details can be found on this PR: WordPress/gutenberg#24476

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@marecar3 marecar3 added this to the 15.5 milestone Aug 5, 2020
@marecar3 marecar3 requested a review from guarani August 5, 2020 20:56
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Aug 5, 2020

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Aug 5, 2020

You can test the changes on this Pull Request by downloading the APK here.

@marecar3
Copy link
Contributor Author

marecar3 commented Aug 6, 2020

This PR is currently not ready for review as both test cases are not working.
We need to add some extra steps (from the user side) after which they will work.

@loremattei loremattei modified the milestones: 15.5, 15.6 Aug 10, 2020
@loremattei
Copy link
Contributor

Hey! I'm moving this to 15.6 since 15.5 has been cut. I see this is marked as Not Ready for review, so I guess it's fine. Otherwise, please feel free to ping me to get it added to 15.5

Copy link
Contributor

@guarani guarani left a comment

Choose a reason for hiding this comment

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

I had an issue with self-hosted: WordPress/gutenberg#24476 (review)

Copy link
Contributor

@etoledom etoledom left a comment

Choose a reason for hiding this comment

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

I have tested on a Jurassic Ninja instance connected via Jetpack and an Atomic site.
In both cases this feature is working as expected! 🎉

For the Jetpack case, I needed to change the web-editor preference manually. This is because of an issue that is external to us (so is the best we can do at this moment).

cc @guarani

Could someone check out the code side of the PR?
@mchowning or @cameronvoell perhaps?

@marecar3
Copy link
Contributor Author

marecar3 commented Sep 4, 2020

I have tested on a Jurassic Ninja instance connected via Jetpack and an Atomic site.
In both cases this feature is working as expected! 🎉

For the Jetpack case, I needed to change the web-editor preference manually. This is because of an issue that is external to us (so is the best we can do at this moment).

cc @guarani

Could someone check out the code side of the PR?
@mchowning or @cameronvoell perhaps?

Thanks, Eduardo!

@marecar3 marecar3 modified the milestones: 15.7, 15.8 Sep 4, 2020
@guarani guarani self-requested a review September 8, 2020 12:20
Copy link
Contributor

@guarani guarani left a comment

Choose a reason for hiding this comment

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

I tried again with a new Jurassic Ninja test site using build 71274 and things worked fine. FWIW, the only difference here was that the WordPress.com account I connected with the site was not an Automattic account.

For the Jetpack case, I needed to change the web-editor preference manually. This is because of an issue that is external to us (so is the best we can do at this moment).

I didn't need to change any web-editor preference, it just worked 🤷‍♂️.

I re-tested Atomic and it's also working well.

@etoledom
Copy link
Contributor

etoledom commented Sep 8, 2020

Thanks for testing @guarani !

I connected with the site was not an Automattic account.
I didn't need to change any web-editor preference, it just worked 🤷‍♂️.

Nice to know that it works with a different account.

Is this account newer than December 2018? (Is your a8c account older than December 2018 anyway?)
AFAIK those older accounts are the ones that had this problem.

@etoledom
Copy link
Contributor

etoledom commented Sep 9, 2020

Is the code side of this PR reviewed?
cc @marecar3 @mchowning

Copy link
Contributor

@mchowning mchowning left a comment

Choose a reason for hiding this comment

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

Just left a couple of small-ish code comments. Otherwise, the code looks good to me.

String token = bundle.getString(ARG_AUTHENTICATION_TOKEN);
boolean isSitePrivate = bundle.getBoolean(ARG_IS_SITE_PRIVATE, false);

boolean isSitePrivate = !gutenbergWebViewAuthorizationData.isWPCom();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is isSitePrivate an accurate name for this variable? Would something like isSelfHosted or !isWpCom be more precise?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for addressing this one. You are right. isSitePrivate isn't an accurate name.
Changed to isSelfHosted .

@@ -427,7 +403,9 @@ public void onActivityResult(int requestCode, int resultCode, @Nullable Intent d
FragmentActivity activity = getActivity();

Bundle arguments = getArguments();
boolean supportStockPhotos = arguments != null && arguments.getBoolean(ARG_SITE_USING_WPCOM_REST_API);
GutenbergWebViewAuthorizationData gutenbergWebViewAuthorizationData =
arguments.getParcelable(ARG_GUTENBERG_WEB_VIEW_AUTH_DATA);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we check for arguments being null here? The next two lines that use the arguments do that with arguments != null && .... Obviously we can't do that here since it's not a boolean, but I think we could achieve that effect if we inline this variable where it is used on line 409, since that is a boolean and has the null check.

There are actually a few places where we don't null check getArguments() in this class. I actually don't feel strongly about null-checking getArguments() because they should never be null as long as they are set (which we do), but I do think we should be consistent--either we always check them or we never do. Having a mix and sometimes checking them seems confusing. We seem closer to always checking them, and that's obviously a bit safer, so that would be my preference but, like I said, I don't feel particularly strongly (particularly if there is no reasonable way to handle a particular case where getArguments() is null). WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, @mchowning! Good point here. We should pick a direction and probably we are closer to check getArguments() to not be null.

Fixed.

@marecar3
Copy link
Contributor Author

Hey @mchowning 👋
I have addressed all comments, you can do another iteration of review! Thanks!

Copy link
Contributor

@mchowning mchowning left a comment

Choose a reason for hiding this comment

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

LGTM! Nice work @marecar3 !

@marecar3
Copy link
Contributor Author

LGTM! Nice work @marecar3!

Thanks, @mchowning!

cc @etoledom this one is ready for merge when the time comes.

@marecar3 marecar3 merged commit 29903f8 into develop Sep 12, 2020
@marecar3 marecar3 deleted the gutenberg/unsupported-block-editor-jetpack-sso-enabled branch September 12, 2020 00:33
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