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

Purchases: Hide plan controls for non-owners at site and account-level #45979

Merged
merged 10 commits into from
Sep 30, 2020

Conversation

fditrapani
Copy link
Contributor

@fditrapani fditrapani commented Sep 29, 2020

Changes proposed in this Pull Request

This makes the subscription settings screen read-only for non-owners.

Before

image

After

image

Testing instructions

  • Enable the site-level-billing flag
  • Visit a product (plan, domain, Jetpack) where you're not the original purchaser
  • Confirm that no renew, add/change payment methods, or cancel/delete subscription buttons are visible

Fixes # #45838

@matticbot
Copy link
Contributor

@matticbot
Copy link
Contributor

matticbot commented Sep 29, 2020

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~352 bytes added 📈 [gzipped])

name            parsed_size           gzip_size
site-purchases       +600 B  (+0.1%)     +176 B  (+0.1%)
purchases            +600 B  (+0.1%)     +176 B  (+0.1%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@michaeldcain michaeldcain added the [Feature Group] WPCOM Store & Purchases All things billing on WordPress.com. This includes the backend store, plans, and billing management. label Sep 29, 2020
@fditrapani
Copy link
Contributor Author

Updated screenshots with the new messaging:

image

showDismiss={ false }
status="is-info"
text={ translate(
'This product was purchased by a different WordPress.com account. To manage this product, log in to that account or contact the account owner.'
Copy link

Choose a reason for hiding this comment

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

ℹ️ String reuse speeds up translation and improves consistency. The following string might make a good alternative and has already been translated 21 times:
translate( 'This plan was purchased by a different WordPress.com account. To manage this plan, log in to that account or contact the account owner.' ) ES Score: 7

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a more generic use of the same sentence. We'll need to update it.

@fditrapani fditrapani marked this pull request as ready for review September 29, 2020 18:37
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Sep 29, 2020
@michaeldcain michaeldcain requested a review from a team September 29, 2020 19:49
@fditrapani
Copy link
Contributor Author

Thanks for the update @michaeldcain. @sirbrillig and @nbloomf, do you mind taking a look at this PR?

@fditrapani
Copy link
Contributor Author

Just added Jetpack Support:

Owner:
image

User:
image

@sirbrillig sirbrillig changed the title Hide plan controls to non-owners Site level billing: Hide plan controls to non-owners Sep 29, 2020
Copy link
Member

@sirbrillig sirbrillig left a comment

Choose a reason for hiding this comment

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

This is looking good! Just a few minor suggestions.

client/me/purchases/manage-purchase/index.jsx Outdated Show resolved Hide resolved
client/me/purchases/manage-purchase/notices.jsx Outdated Show resolved Hide resolved
@sirbrillig sirbrillig changed the title Site level billing: Hide plan controls to non-owners Purchases: Hide plan controls for non-owners at site and account-level Sep 30, 2020
Copy link
Member

@sirbrillig sirbrillig left a comment

Choose a reason for hiding this comment

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

I still can't figure out a way to get to a subscription that I don't own, but the code looks good and if you're able to test it, then it's probably safe. 👍

@michaeldcain
Copy link
Member

I still can't figure out a way to get to a subscription that I don't own

@sirbrillig if you have two accounts that are both admins on the same site, purchase a plan with one of them and then switch to the other to follow the testing instructions

@sirbrillig
Copy link
Member

Thanks! Works as described!

Screen Shot 2020-09-30 at 11 52 43 AM

@fditrapani
Copy link
Contributor Author

Awesome, thanks for testing again @sirbrillig. Just waiting for tests to clear again.

@fditrapani fditrapani force-pushed the add/account-restrictions-to-site-level-billing branch from 00db3c8 to 9e9af33 Compare September 30, 2020 16:11
@fditrapani fditrapani force-pushed the add/account-restrictions-to-site-level-billing branch from 9e9af33 to 7d940b1 Compare September 30, 2020 16:29
@fditrapani fditrapani merged commit 8e8c34d into master Sep 30, 2020
@fditrapani fditrapani deleted the add/account-restrictions-to-site-level-billing branch September 30, 2020 17:09
@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 Sep 30, 2020
@a8ci18n
Copy link

a8ci18n commented Sep 30, 2020

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/4630077

Thank you @fditrapani for including a screenshot in the description! This is really helpful for our translators.

@fditrapani fditrapani self-assigned this Oct 1, 2020
@a8ci18n
Copy link

a8ci18n commented Oct 9, 2020

Translation for this Pull Request has now been finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Estimate] 2 [Feature Group] WPCOM Store & Purchases All things billing on WordPress.com. This includes the backend store, plans, and billing management.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants