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

Add 'Debug' option for API requests in Apple News to output debugging info #1111

Merged
merged 11 commits into from
May 2, 2024

Conversation

attackant
Copy link
Member

@attackant attackant commented Apr 29, 2024

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

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.
@attackant attackant marked this pull request as draft April 29, 2024 21:04
@attackant attackant linked an issue Apr 29, 2024 that may be closed by this pull request
@attackant attackant self-assigned this Apr 29, 2024
@attackant attackant added the enhancement New feature or request label Apr 29, 2024
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.
@attackant attackant marked this pull request as ready for review April 30, 2024 14:48
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.
@attackant attackant changed the base branch from develop to release/v2.5.0 April 30, 2024 15:02
….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.
Comment on lines 558 to 561
$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 );
Copy link

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Great, will update.

Copy link
Member Author

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 );
Copy link

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?

Copy link
Member Author

@attackant attackant May 2, 2024

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link

@mogmarsh mogmarsh left a 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.

attackant added 4 commits May 1, 2024 20:58
The method of retrieving post metadata in the Apple News plugin has been changed to match other commits in this version.
@attackant attackant requested a review from mogmarsh May 2, 2024 03:39
Copy link

@mogmarsh mogmarsh left a comment

Choose a reason for hiding this comment

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

👍 looks good. thanks!

@attackant attackant merged commit fd68683 into release/v2.5.0 May 2, 2024
8 checks passed
@attackant attackant deleted the issue-1110 branch May 2, 2024 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Debugging Mechanism for Apple News API Requests
2 participants