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

Connection: properly add GET-parameters for the fetchAuthorizationUrl API call #21750

Merged
merged 13 commits into from
Nov 23, 2021

Conversation

sergeymitr
Copy link
Contributor

@sergeymitr sergeymitr commented Nov 16, 2021

Changes proposed in this Pull Request:

Bug: fetchAuthorizationUrl API method (RNA API package) did not include the no_iframe parameter in "plain permalinks" mode.
Therefore, site-connected users are unable to connect their user accounts to WP.com if the site has "plain permalinks" enabled.

Does this pull request change what data or activity we track or use?

No.

Testing instructions:

First, reproduce the issue without checking out the branch.

  1. Connect Jetpack in site-only mode.
  2. Go to "Settings -> Permalinks" and choose "Plain".
  3. Go to Jetpack Dashboard and try to connect the user. You should end up on the jetpack.authorize_iframe page with minimal UI.
  4. Now checkout the branch, rebuild plugins/jetpack if needed, and try to connect the user one more time. Confirm that everything went well.

@sergeymitr sergeymitr added [Type] Bug When a feature is broken and / or not performing as intended [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Pri] High labels Nov 16, 2021
@sergeymitr sergeymitr added this to the jetpack/10.3.1 milestone Nov 16, 2021
@sergeymitr sergeymitr self-assigned this Nov 16, 2021
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello sergeymitr! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D70131-code works as expected before merging this PR. Once this PR is merged, please commit the changes to WP.com. Thank you!
This revision will be updated with each commit to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Nov 16, 2021

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: December 7, 2021.
  • Scheduled code freeze: November 30, 2021.

Backup plugin:

  • Next scheduled release: December 7, 2021.
  • Scheduled code freeze: November 29, 2021.

@leogermani
Copy link
Contributor

Don't you think it's time to deprecate the jetpack_use_iframe_authorization_flow filter and never set $iframe_flow to true again?

$iframe_flow = apply_filters( 'jetpack_use_iframe_authorization_flow', false );

This would ensure the iframe flow will never be returned in any case.

@sergeymitr
Copy link
Contributor Author

Hi @leogermani.

Don't you think it's time to deprecate the jetpack_use_iframe_authorization_flow filter and never set $iframe_flow to true again?

Deprecate - yes, good idea, I'll do that.
But I don't think we can remove that filter entirely, as it will break older Jetpacks. We should wait a bit longer.

@sergeymitr sergeymitr added [Status] In Progress and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Nov 16, 2021
@leogermani
Copy link
Contributor

if you deprecate it and force it to false, no need to enforce the no_iframe parameter in the API request

@sergeymitr
Copy link
Contributor Author

@leogermani,
I'm worried that if we disable that in the package, old JS might receive the non-iframe URL where it expects the iframe one, breaking everything.
This is an unlikely situation where one needs to have an old Jetpack installed alongside a fresh plugin with latest Connection package. But we need to take that into account still.
As far as I know, we cannot force the non-iframe flow over old Jetpack versions. We should be able to for the main flow, but not for the secondary ones.

If I'm missing something, please let me know.

@github-actions github-actions bot added [JS Package] Connection [JS Package] IDC [JS Package] Storybook [Package] Connection UI This package no longer exists in the monorepo. [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels Nov 16, 2021
@sergeymitr sergeymitr force-pushed the fix/plain-permalinks-authorization-url branch from a965f5c to e740fb5 Compare November 16, 2021 18:23
@github-actions github-actions bot added [Package] Connection UI This package no longer exists in the monorepo. [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels Nov 16, 2021
@sergeymitr sergeymitr added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] In Progress labels Nov 16, 2021
@sergeymitr sergeymitr requested a review from jeherve November 18, 2021 18:55
samiff
samiff previously approved these changes Nov 23, 2021
Copy link
Contributor

@samiff samiff left a comment

Choose a reason for hiding this comment

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

Looks good, after patching I no longer saw the jetpack.authorize_iframe

@samiff samiff added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Nov 23, 2021
@sergeymitr sergeymitr merged commit b0c60db into master Nov 23, 2021
@sergeymitr sergeymitr deleted the fix/plain-permalinks-authorization-url branch November 23, 2021 21:51
@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Nov 23, 2021
@github-actions
Copy link
Contributor

Great news! One last step: head over to your WordPress.com diff, D70131-code, and commit it.
Once you've done so, come back to this PR and add a comment with your changeset ID.

Thank you!

@sergeymitr
Copy link
Contributor Author

r235541-wpcom

davidlonjon added a commit that referenced this pull request Nov 25, 2021
# By Jeremy Herve (5) and others
# Via GitHub
* master: (26 commits)
  Colors: update Primary green reference to match latest brand book (#21741)
  JS Connection: Moves registerSite logic to the store (#21732)
  Search: Add essential scaffolding for package (#21814)
  Search: avoid registering the widget when the module is not active (#21588)
  Add Video Tracks Support to VideoPress Block (#21578)
  Add deprecated to VideoPress block (#21802)
  Admin Menu: Make API tests compatible with WPCOM (#21850)
  External Media: Short-circuit requests earlier in the stack (#21854)
  Add Busy State to License Activation Flow Button (#21861)
  Fixed an issue with screen resolutions of under 783px that caused the content to not be properly displayed when the nav-unification is expanded on wp-admin. (#21869)
  E2E tests: migrate from Jest to Playwright runner (#21848)
  Update reCAPTCHA constants to match Google's Verbage (#12289)
  JITM: Sideload Jetpack Boost functionality  (#21860)
  Connection: properly add GET-parameters for the `fetchAuthorizationUrl` API call (#21750)
  License Flow: Assorted Styling Improvements (#21859)
  JITM: Sideload Jetpack Backup (#21719)
  Widget Visibility: Apply widget filtering to customizer preview (#21505)
  jetpack: Avoid generating unused JS for static-site-generator assets (#21789)
  Nav Unification: Support absolute URLs in upsell nudges (#21821)
  RePublicize: Enable the block editor UI by default (#21855)
  ...

# Conflicts:
#	projects/plugins/boost/tests/e2e/lib/env/prerequisites.js
#	projects/plugins/boost/tests/e2e/lib/setupTests.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[JS Package] API [JS Package] Connection [JS Package] IDC [JS Package] Licensing [JS Package] Storybook [Package] Connection UI This package no longer exists in the monorepo. [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ RNA Touches WP.com Files [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants