Skip to content

Memberships: Check plan before displaying the block#12348

Merged
artpi merged 3 commits intomasterfrom
memberships/plan-gating
May 22, 2019
Merged

Memberships: Check plan before displaying the block#12348
artpi merged 3 commits intomasterfrom
memberships/plan-gating

Conversation

@artpi
Copy link
Copy Markdown
Contributor

@artpi artpi commented May 13, 2019

This PR blocks the usage of a block (ahem) if you are on a free plan. This is a part of Automattic/wp-calypso#32984 (comment)

Additionallly, this PR simplifies the status endpoint, directly passes the response from WPCOM and makes it easier to fix pieces later.

Screenshots

Zrzut ekranu 2019-05-13 o 16 45 22

Testing instruction

Jetpack ngrok solution

  1. Make sure to check out D28126-code on your sandbox and define( 'JETPACK__SANDBOX_DOMAIN', 'your-public-sandboxed-site' );
  2. Try to use a block on a site that is on a paid plan. You should get "connect stripe account" or - if you connected - product selection
  3. Try to use on a free site. You should get "Uprade your site"

WPCOM simple

You only need to test D28126-code on your sandbox

@artpi artpi requested a review from a team May 13, 2019 14:55
@artpi artpi self-assigned this May 13, 2019
@matticbot
Copy link
Copy Markdown
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello artpi! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer, review, and approve D28126-code before merging this PR. Thank you!

@jetpackbot
Copy link
Copy Markdown
Collaborator

jetpackbot commented May 13, 2019

Warnings
⚠️ "Testing instructions" are missing for this PR. Please add some
⚠️ "Proposed changelog entry" is missing for this PR. Please include any meaningful changes

This is an 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 against fc51d60

@artpi artpi requested a review from davemart-in May 13, 2019 14:57
@jeherve jeherve added [Block] Payment Button aka Recurring Payments [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack labels May 13, 2019
@artpi artpi requested review from eoigal and prettyboymp May 13, 2019 15:53
@artpi artpi added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels May 13, 2019
davemart-in
davemart-in previously approved these changes May 13, 2019
Copy link
Copy Markdown
Contributor

@davemart-in davemart-in left a comment

Choose a reason for hiding this comment

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

If we can remove the period in the button, I'm 👍LGTM!

@jeherve jeherve added this to the 7.4 milestone May 14, 2019
@jeherve
Copy link
Copy Markdown
Member

jeherve commented May 14, 2019

Related discussion: p8hgLy-1tg-p2#comment-2615

@jeherve jeherve added [Status] Needs Product Review Consider posting about this on an internal P2 for discussion [Status] Needs Design Review Design has been added. Needs a review! labels May 14, 2019
@jeherve jeherve removed this from the 7.4 milestone May 14, 2019
@scottsweb
Copy link
Copy Markdown
Contributor

I haven't tested this PR but from looking at the screenshot I am happy for this to proceed.

My only slight hesitation is seeing the term "memberships" and "plans" together, they could easily mean the same thing.

You will need to upgrade your plan to use the membership button

👏 This is a nice bit of clarification. When we are referencing 'plan' here, is it a Jetpack plan or a .com plan? or both?

@scottsweb scottsweb removed the [Status] Needs Design Review Design has been added. Needs a review! label May 14, 2019
@matticbot
Copy link
Copy Markdown
Contributor

artpi, Your synced wpcom patch D28126-code has been updated.

@artpi artpi requested a review from jeherve May 14, 2019 14:31
@artpi artpi added [Status] In Progress and removed [Status] Needs Review This PR is ready for review. labels May 14, 2019
@artpi
Copy link
Copy Markdown
Contributor Author

artpi commented May 14, 2019

artpi, Your synced wpcom patch D28126-code has been updated.

Fusion just mangled D28126-code . I attached there code that was not in JP repo and now it deleted it. I need to work on 3rd pr to land this.

@jeherve
Copy link
Copy Markdown
Member

jeherve commented May 14, 2019

Fusion just mangled D28126-code

That's to be expected unfortunately. Fusion has no way to know about the previous state of the diff right now, so it just reapplies the new diff it gets from the PR. If you have changes to other files, I'd recommend making them in a separate diff if you can.

@artpi artpi force-pushed the memberships/plan-gating branch from 216de1f to 6f4add3 Compare May 16, 2019 10:11
@matticbot
Copy link
Copy Markdown
Contributor

artpi, Your synced wpcom patch D28126-code has been updated.

@artpi artpi added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels May 16, 2019
@jeherve jeherve added this to the 7.4 milestone May 22, 2019
@jeherve jeherve removed the [Status] Needs Product Review Consider posting about this on an internal P2 for discussion label May 22, 2019
jeherve
jeherve previously approved these changes May 22, 2019
Copy link
Copy Markdown
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

This works well for me, but I wonder if we should add a link to recheck the status of your site in the block editor once you've purchased a plan, just like we have when you first add the block before it's connected to Stripe:

image

What do you think?

This can be done in a next PR though, so approving this one for now.

@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 May 22, 2019
davemart-in
davemart-in previously approved these changes May 22, 2019
Copy link
Copy Markdown
Contributor

@davemart-in davemart-in left a comment

Choose a reason for hiding this comment

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

🤘🚀

@artpi artpi dismissed stale reviews from davemart-in and jeherve via 34c082b May 22, 2019 14:26
@artpi artpi force-pushed the memberships/plan-gating branch from 6f4add3 to 34c082b Compare May 22, 2019 14:26
@matticbot
Copy link
Copy Markdown
Contributor

artpi, Your synced wpcom patch D28126-code has been updated.

artpi and others added 3 commits May 22, 2019 17:18
@artpi artpi force-pushed the memberships/plan-gating branch from 34c082b to fc51d60 Compare May 22, 2019 15:18
@matticbot
Copy link
Copy Markdown
Contributor

artpi, Your synced wpcom patch D28126-code has been updated.

@artpi artpi merged commit 128ec00 into master May 22, 2019
@artpi artpi deleted the memberships/plan-gating branch May 22, 2019 16:58
@jeherve jeherve added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! [Status] Needs Changelog labels May 22, 2019
jeherve added a commit that referenced this pull request May 27, 2019
* Kick off the changelog

* Add 7.3.1

* Update date and post link

* changelog: add #12219

* changelog: add #12170

* changelog: add #12184

* Changelog: add #12268

* Changelog: add #12081

* Changelog: add #12323

* Changelog: add #12204

* Changelog: add #12269

* Changelog: add #12332

* changelog: add #12339

* changelog: add #12209

* Changelog: add #12319

* Changelog: add #12357

* Changelog: add #12124

* Changelog: add #12373

* Changelog: add #12252

* Changelog: add #12383

* Changelog: add #12372

* changelog: add #12337

* Changelog: add #12290

* Changelog: add #12301

* Changelog: add #12061

* Testing list: add instructions for #12061

* Changelog: add #12393

* Update minimum supported version

See #12287

* Changelog: add #12406

* Testing list: add #12406

* Changelog: add #12277

* Changelog: add #12412

* Changelog: add #11318

* Changelog: add #12328

* Changelog: add #12425

* Changelog: add #12380

* Changelog: add #12428

* Changelog: add #12414

* Changelog: add #12395

* Changelog & Testing list: add #12416, #12417, #12418, and #12348

* changelog: add #12379

* Changelog: add #12341

* changelog: add #12444

* Changelog: add #12434

* Changelog: add #12454

* Changelog: add #12460

* Changelog: add #12463

* Changelog: add #12457

* Changelog / testing list: add #10333

* Changelog: add #12467


Co-authored-by: Jeremy Herve <jeremy@jeremy.hu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Payment Button aka Recurring 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.

6 participants