Closed westonruter closed 4 years ago
This fixed the issue according to user testing: https://github.com/ampproject/amp-wp/issues/5297#issuecomment-683387449
Also LGTM. Thanks for the PR @westonruter . This will be released in 2.1.4
@westonruter thanks !
A user reported an issue for the official AMP plugin where the OneSignal plugin was sending out push notifications for updates to the non-public
amp_validated_url
post type: https://github.com/ampproject/amp-wp/issues/5297When the AMP plugin's Developer Tools are enabled, each save for a post will trigger a loopback request to check the AMP validity of the post on the frontend. The results are then stored in an
amp_validated_url
post type. While this post type is private, the posts are stored with thepublish
status. Nevertheless, they cannot be viewed on the frontend.OneSignal is incorrectly detecting updates to the published
amp_validated_url
posts as needing push notifications. This likely is an issue for other post types in WordPress, including core'scustomize_changeset
andnav_menu_item
post types.In looking at the logic in
\OneSignal_Admin::send_notification_on_wp_post()
I see no checks for whether the post type being saved is actually public, in particular when$posted_from_wordpress_editor
is true.This PR should offer a quick way to prevent this from happening.
This change is