-
Notifications
You must be signed in to change notification settings - Fork 794
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
Make default payment block plan names dynamic #25397
Conversation
When adding a new plan, the plan name will update depending upon the payment options selected - whether it's a donation and what the payment frequency is. This aids users in naming their plans appropriately and reduces the likelihood of having umpteen plans called 'Monthly subscription' when they're nothing of the sort. If the user explicitly chooses a name then that is respected and not overwritten.
Caution: This PR has changes that must be merged to WordPress.com |
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped. Jetpack plugin:
|
@@ -83,6 +84,15 @@ export default function ProductManagementInspectorControl() { | |||
); | |||
}; | |||
|
|||
useEffect( () => { | |||
// If the user has manually selected a title then that should be left as-is, don't overwrite it | |||
if ( isCustomTitle ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I could get rid of this state by checking if the current title
from the state matches anything that getTitleByProps
could return?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, that could work, but it's fine to leave this as-is. The other benefit of getting rid of this state is that if the user undoes their changes and goes back to a default title, we'd be again changing the title according to the type/interval. In other words:
- User changes title to "My Subscription"
- User changes interval to "Yearly"
- User changes title to "Yearly Subscription"
- User changes type to "Donation"
The isCustomTitle
check would keep the title as "Yearly Subscription", but if replace it with a check against the default values, the title will change to "Yearly Donation".
Anyway, this is an edge case, so feel free to ignore this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tests well! I left a minor non-blocking comment, but this good to go.
@@ -83,6 +84,15 @@ export default function ProductManagementInspectorControl() { | |||
); | |||
}; | |||
|
|||
useEffect( () => { | |||
// If the user has manually selected a title then that should be left as-is, don't overwrite it | |||
if ( isCustomTitle ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, that could work, but it's fine to leave this as-is. The other benefit of getting rid of this state is that if the user undoes their changes and goes back to a default title, we'd be again changing the title according to the type/interval. In other words:
- User changes title to "My Subscription"
- User changes interval to "Yearly"
- User changes title to "Yearly Subscription"
- User changes type to "Donation"
The isCustomTitle
check would keep the title as "Yearly Subscription", but if replace it with a check against the default values, the title will change to "Yearly Donation".
Anyway, this is an edge case, so feel free to ignore this!
Great news! One last step: head over to your WordPress.com diff, D85442-code, and deploy it. Thank you! |
Deployed r250190-wpcom |
Partly fixes #24074 but a similar change will be needed in Calypso
Changes proposed in this Pull Request:
When adding a new plan, the plan name will update depending upon the payment options selected - whether it's a donation and what the payment frequency is.
This aids users in naming their plans appropriately and reduces the likelihood of having umpteen plans called 'Monthly subscription' when they're nothing of the sort.
If the user explicitly chooses a name then that is respected and not overwritten.
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
No
Testing instructions:
Demo
Screen.Capture.on.2022-08-05.at.13-46-55.mp4