jetpack
jetpack copied to clipboard
Memberships: Fix mixed membership products
- Mixing tiered memberships products will gate the access check to the tiered newsletter code path
- The tiered newsletter code path will see if the user is subscribed to any plans with a rate equal to or higher the cheapest tiered newsletter in the chosen products
- If the user subscribes with a non-tiered newsletter product that is at a rate lower than the cheapest tiered newsletter, the user won't have access
Fixes https://github.com/Automattic/gold/issues/403
Proposed changes:
- Separates product access checks into tiered and non-tiered
- Runs access checks for both product types
Other information:
- [x] Have you written new tests for your changes, if applicable?
- [x] Have you checked the E2E test CI results, and verified that your changes do not break them?
- [x] Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
- Wait to apply this patch
- If testing yourself, set up with newsletters, create a post and add a premium content block to it, add a tiered newsletter product and a lower priced non-tiered product
- Alternatively, visit https://neilrobertstest.wordpress.com/2024/04/16/silver-premium-content/
- Open a private window
- Subscribe to the tiered newsletter product using a unique address (e.g. [email protected])
- Verify you can see the subscriber view
- Open a second private window and visit the premium content
- Subscribe to the non-tiered product using a unique address (e.g. [email protected])
- Verify you can't see the subscriber view
- Switch your Jetpack branch to this PR
- Make sure the hosts for your sandbox is pointing to that site
- Refresh both private windows and verify you can see the subscriber view