-
Notifications
You must be signed in to change notification settings - Fork 157
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
Enable filtering whether Distributor should update distributed post statuses when the origin post status changes #446
base: develop
Are you sure you want to change the base?
Conversation
# Conflicts: # includes/classes/Authentications/WordPressDotcomOauth2Authentication.php # includes/syndicated-post-ui.php
@@ -556,7 +559,7 @@ public function push( $post_id, $args = array() ) { | |||
'slug' => $post->post_name, | |||
'content' => Utils\get_processed_content( $post->post_content ), | |||
'type' => $post->post_type, | |||
'status' => ( ! empty( $args['post_status'] ) ) ? $args['post_status'] : 'publish', | |||
'status' => ( ! empty( $args['post_status'] ) ) ? $args['post_status'] : $distribute_status, |
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.
@adamsilverstein If I mark $distribute_post_status
as true, the source post status will only be distributed if $args['post_status']
is empty. $args['post_status']
comes from the connection map for the origin post, how is that populated or changed? In any case, going off the filter name I would expect $distribute_post_status
to always take precedence, but it's very possible I'm woefully missing context here.
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 this case of push, the post_status
comes from whether you have checked the 'distribute as draft' checkbox, if you have that setting overrides the filter. I do need to test subscriptions and pull, i'm not sure that works correctly. See
distributor/includes/push-ui.php
Lines 248 to 250 in b1dd60f
if ( ! empty( $_POST['postStatus'] ) ) { | |
$push_args['post_status'] = $_POST['postStatus']; | |
} |
In reviewing open PRs in the 1.6.0 milestone, this PR seemed still too risky and in need of testing/confirmation before merging so I'm going to punt this to our next release in hopes of having things in a more stable state by then. |
Unassigning reviewers here while we focus on the v2 refactoring and can then reassess how best to handle the root issue here. |
@adamsilverstein thanks for the PR! Could you please rebase your PR on top of the latest changes in the base branch? |
Description of the Change
Filter whether Distributor should update distributed post statuses when the origin post status changes.
Closes #112.
Benefits
Enables distributing post status when desired, eg. takedowns.
Verification Process
Code review without whitespace: https://github.com/10up/distributor/pull/446/files?w=1
Repeat the following tests with a
Network Connection
and anExternal Connection
Enable filter:
add_filter( 'dt_distribute_post_status', '__return_true' );
Pull post subscription - pull published post then test changing origin post from published to draft also changes pulled copies status
Push post - push published post then test changing origin post from published to draft also changes pushed copies status
Disable filter:
add_filter( 'dt_distribute_post_status', '__return_false' );
Pull post subscription - pull published post then test changing origin post from published to draft also changes pulled does not copy status
Push post - push published post then test changing origin post from published to draft also changes pushed does not copy status
Unit tests
Network Connection
External Connection
Checklist:
Applicable Issues