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

Premium Content: Fix redirect behavior after connecting to Stripe #45204

Merged
merged 2 commits into from Aug 26, 2020

Conversation

blackjackkent
Copy link
Contributor

Changes proposed in this Pull Request

  • This pull request updates the call which fetches information from the API used to generate the "Connect to Stripe" button in the Premium Content block if the user's account is not currently connected. It records whether the user is using the block editor on wordpress.com (iframed via Gutenframe) or whether they accessed it via WP-Admin, and causes the user to be redirected back to the appropriate place after connecting successfully.
  • (This PR also contains a number of fixes to issues that ESLint was highlighting, preventing the main change from being committed. These have all been contained to the first commit of the PR.)

Testing instructions

  • Make sure your account is not connected to Stripe and that you have sandboxed the store. (see PCYsg-lW4-p2 #sandbox-method for detailed instructions).
  • Load the version of the full-site-editing plugin from this PR following one of the methods detailed in PCYsg-5Xx-p2.
  • Navigate to https://wordpress.com/posts/yoursite.wordpress.com and click "Add New Post"
  • In the block editor, add a premium content block. You should be given a message indicating you need to connect your account to Stripe.
  • Click the "Connect" button. On the Stripe account form, you should see a development mode link to skip the form. Click it.
  • Verify that you are redirected back to wordpress.com/block-editor.
  • Disconnect account from Stripe again.
  • Navigate to your site's wp-admin panel and create a new post from there.
  • Again add a premium content block and click the Stripe connection button, then skip the form.
  • Verify that this time, you are redirected back to the block editor on wp-admin/post.php
    Verify that under the Edit view in the "Non-Subscriber View" section, the user is only presented with a single message indicating they should connect the account to Stripe.

Fixes #43222

@blackjackkent blackjackkent added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Aug 25, 2020
@blackjackkent blackjackkent requested a review from a team August 25, 2020 21:17
@blackjackkent blackjackkent self-assigned this Aug 25, 2020
@matticbot
Copy link
Contributor

@matticbot
Copy link
Contributor

Caution: This PR affects files in the Editing Toolkit Plugin on WordPress.com
Please ensure your changes work on WordPress.com before merging.

D48591-code has been created so you can easily test it on your sandbox. See this FieldGuide page about developing the Editing Toolkit Plugin for more info: PCYsg-ly5-p2

@matticbot
Copy link
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

Copy link
Contributor

@kwight kwight 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 some testing confusion over two seeing two Connect buttons, but I got this to work 🎉

@krymson24
Copy link
Contributor

What's the purpose of adding the extra commentary after -? Is the purpose of it to be helpful to future developers? Furthermore, some changes made the type definitions less specific and more generic -- not sure if that's intentional.

@blackjackkent
Copy link
Contributor Author

@krymson24 All the changes in the first commit of this PR were to address issues that the linter had with the file (without which Husky wouldn't let the main commit go through). Some of these issues included missing JSDoc descriptions for params (the info after the -) and certain type values not being found (I think bc those type values are Typescript info being included in a JS file). I'm open to suggestions on better ways to address these issues though! :D

@blackjackkent blackjackkent merged commit 4f29c98 into master Aug 26, 2020
@blackjackkent blackjackkent deleted the fix/premium-content-stripe-redirect branch August 26, 2020 16:29
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Aug 26, 2020
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.

Premium Content: Connecting stripe will send Gutenframe users to WP Admin.
4 participants