-
Notifications
You must be signed in to change notification settings - Fork 823
Newsletter Categories: add helper class #44537
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
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
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 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 3 files.
1 file is newly checked for coverage.
|
@@ -54,7 +54,10 @@ function NewsletterCategories( props ) { | |||
dispatch, | |||
} = props; | |||
|
|||
const checkedCategoriesIds = newsletterCategories.map( mapCategoriesIds ); |
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 was causing an error because it is possible for newsletterCategories
to be undefined in the beginning
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.
projects/plugins/jetpack/_inc/lib/core-api/class.jetpack-core-api-module-endpoints.php
Show resolved
Hide resolved
@allilevine thanks for pointing that out. I did not know that this was an issue as well I thought only the category picker was broken. |
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.
All Calypso category settings changes are working for me. ✅
Fixes CML-687
Proposed changes:
WPCOM_JSON_API_Site_Settings_Endpoint
andJetpack_Core_API_Data
The original issue was related to the
wpcom_newsletter_categories
option being stored in one format[{term_id: 123}, {term_id: 456}]
but being returned in 2 different versions. The API endpoint was returning[123, 456]
but the redux store for Jetpack was being populated with the raw version. This was causing discrepancies in how we display and save the data.To prevent code duplication and allow for cleaner testing I made a helper class.
Other information:
Jetpack product discussion
No
Does this pull request change what data or activity we track or use?
No
Testing instructions:
Add this change to an Atomic site.
YOUR_ATOMIC_SITE.com/wp-admin/admin.php?page=jetpack#newsletter
window.Initial_State.settings.wpcom_newsletter_categories
to make sure you are getting the proper formatting.Add this change to an Atomic site.
https://wordpress.com/settings/newsletter/YOUR_ATOMIC_SITE.com