Skip to content

Simple Payments: PayPal script execution error on Gutenberg - #10531

Merged
simison merged 1 commit into
masterfrom
fix/simple-payments-frontend-only-register-scripts
Nov 8, 2018
Merged

simison merged 1 commit into
masterfrom
fix/simple-payments-frontend-only-register-scripts

Conversation

@rodrigoi

@rodrigoi rodrigoi commented Nov 2, 2018 •

Copy link
Copy Markdown
Contributor

PayPal scripts are registered only for the site's Frontend to prevent execution errors when loading Gutenberg on WP-Admin.

Fixes #10481

Changes proposed in this Pull Request:

  • Prevent registering PayPal Express Checkout scripts on the Admin Page.

Testing instructions:

screen shot 2018-11-02 at 18 04 40

  • Navigate to the published post and verify that there are no regressions on the site's frontend.

…ontend to prevent execution errors when loading Gutenberg on WP-Admin.
@rodrigoi rodrigoi added Bug When a feature is broken and / or not performing as intended [Status] Needs Review This PR is ready for review. Simple Payments [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack labels Nov 2, 2018
@rodrigoi rodrigoi added this to the 6.8 milestone Nov 2, 2018
@rodrigoi rodrigoi self-assigned this Nov 2, 2018
@rodrigoi
rodrigoi requested review from a team, simison and tyxla November 2, 2018 21:08
@matticbot

Copy link
Copy Markdown
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Please review this diff before merging: D20285-code. (newly created revision)

@jetpackbot

Copy link
Copy Markdown
Collaborator
Warnings
⚠️

"Proposed changelog entry" is missing for this PR. Please include any meaningful changes

This is automated check which relies on PULL_REQUEST_TEMPLATE.We encourage you to follow that template as it helps Jetpack maintainers do their job. If you think 'Testing instructions' or 'Proposed changelog entry' are not needed for your PR - please explain why you think so. Thanks for cooperation 🤖

Generated by 🚫 dangerJS

add_filter( 'rest_api_allowed_post_types', array( $this, 'allow_rest_api_types' ) );
add_filter( 'jetpack_sync_post_meta_whitelist', array( $this, 'allow_sync_post_meta' ) );
$this->register_scripts_and_styles();
if ( ! is_admin() ) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These scripts are not useful even if we're on wp-admin without Gutenberg? I.e. classic editor won't be missing them?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The classic editor doesn't need them. These are just for the frontend to wire the actual pay button.

@simison
simison requested a review from sirreal November 5, 2018 10:46
@sirreal
sirreal requested review from a team and removed request for sirreal and tyxla November 5, 2018 15:46

@sirreal sirreal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I tested this following the steps here and those described in #10481. Everything seems to be working well.

  • No errors in WP Admin Gutenberg editor.
  • Calypso editor continues to work fine.
  • Payment button is functional on the frontend of the site.

Thanks, 🚢 !

@sirreal
sirreal removed the request for review from a team November 5, 2018 16:41
@simison simison added [Status] Ready to Merge Go ahead, you can push that green button! [Status] Needs Review This PR is ready for review. and removed [Status] Needs Review This PR is ready for review. [Status] Ready to Merge Go ahead, you can push that green button! labels Nov 6, 2018

@tyxla tyxla left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've also verified this fixes the issue, thanks 👍

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Nov 7, 2018

@jeherve jeherve left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Merge when ready! 🚢

@simison
simison merged commit 756d2cb into master Nov 8, 2018
@simison
simison deleted the fix/simple-payments-frontend-only-register-scripts branch November 8, 2018 10:58
@ghost ghost removed the [Status] Ready to Merge Go ahead, you can push that green button! label Nov 8, 2018
jeherve pushed a commit that referenced this pull request Nov 8, 2018
…ontend to prevent execution errors when loading Gutenberg on WP-Admin. (#10531)
@jeherve jeherve modified the milestones: 6.8, 6.7.1 Nov 8, 2018
@jeherve

jeherve commented Nov 8, 2018

Copy link
Copy Markdown
Member

Cherry-picked to branch-6.7 in 1b58e69

@jeherve jeherve modified the milestones: 6.7.1, 6.8 Nov 22, 2018
@jeherve jeherve added the [Feature] Pay with PayPal aka Simple Payments label Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug When a feature is broken and / or not performing as intended [Feature] Pay with PayPal aka Simple Payments [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack Touches WP.com Files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simple Payments: shortcode in Gutenberg fails PayPal script

7 participants