Enable filtering whether Distributor should update distributed post statuses when the origin post status changes#446
Conversation
# Conflicts: # includes/classes/Authentications/WordPressDotcomOauth2Authentication.php # includes/syndicated-post-ui.php
| '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.
@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.
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
|
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 Connectionand anExternal ConnectionEnable 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