-
Notifications
You must be signed in to change notification settings - Fork 71
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
Add 'Debug' option for API requests in Apple News to output debugging info #1111
Conversation
A 'Debug' link has been added to the API request in the admin section of the Apple News plugin. This link, which opens in a new tab, can be used for debugging purposes. It is particularly useful for showing the API request.
The code changes modify the debug URL generation in the Apple News plugin. Instead of directly using the 'get_permalink' method, it now calls the 'action_query_params' method from the Admin_Apple_Index_Page class. This change enhances the URL generation by organizing the query parameters for the debug action.
A 'debug' case has been added to the action mapping in the Apple News admin. This action corresponds to a new 'debug_action' function, which initiates a debug process for a post identified by a given ID. This function will help to facilitate issue identification and resolution.
The `push` action code in the Apple News plugin has been significantly refactored adding a debugging method which shows the data that will be sent to the API. The action of getting custom post metadata has been moved into a separate private method, `get_meta`, to keep the class DRY.
This commit updates the version of the Publish to Apple News plugin from 2.4.8 to 2.4.9. The new version includes debugging for Apple News API requests, as indicated by the change in the readme file. The version number has been updated in all relevant files.
The 'publish-to-apple-news' plugin version has been upgraded from 2.4.8 to 2.4.9. Key dependencies including '@wordpress/*' packages and '@babel/*' packages have also been updated to newer versions, enhancing compatibility with WP 6.5 and resolving potential issues. 'package-lock.json' has been revised to reflect these modifications.
….5.0 The version of the "Publish to Apple News" WordPress plugin has been updated from 2.4.9 to 2.5.0. This is reflected in all files where the version number is declared. This versioning update indicates the inclusion of new enhancements or bug fixes.
$is_paid = (bool) get_post_meta( $post_id, 'apple_news_is_paid', true ); | ||
$is_preview = (bool) get_post_meta( $post_id, 'apple_news_is_preview', true ); | ||
$is_hidden = (bool) get_post_meta( $post_id, 'apple_news_is_hidden', true ); | ||
$is_sponsored = (bool) get_post_meta( $post_id, 'apple_news_is_sponsored', true ); |
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.
in 2.5.0, these actually can be set by the meta or inherit the channel default, so they won't always be bool
any more. See https://github.com/alleyinteractive/apple-news/pull/1090/files
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.
Great, will update.
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.
Give this a look, thanks Greg.
return; | ||
} | ||
|
||
$action = new Apple_Actions\Index\Push( $this->settings, $id ); |
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.
does this actually push it? Is that what we want to happen?
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.
No, just calls the constructor and sends in the settings, we only call the debug
method, not the push
method, then debug info is printed to the screen and then exits. I'll add a bit of documentation to the README.
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.
Added some docs here: https://github.com/alleyinteractive/apple-news/wiki/Usage#debug-api-requests
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 looks good, but there is a change to the is_
meta in 2.5.0 that you'll need to incorporate. Also, I had a question about if the debug actually pushes it.
Hit me up for another review. I don't want this to hold you up.
The method of retrieving post metadata in the Apple News plugin has been changed to match other commits in this version.
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.
👍 looks good. thanks!
A 'Debug' link has been added to the API request in the admin section of the Apple News plugin. This link, which opens in a new tab, can be used for debugging purposes. It is particularly useful for showing the API request.
Also syncs WP scripts node dependencies with WordPress 6.5
Addresses #1110