Network connection: avoid updating the status of previously distributed posts#110
Network connection: avoid updating the status of previously distributed posts#110
Conversation
barryceelen
left a comment
There was a problem hiding this comment.
Thanks for the update!
This change would prevent passing a post status for an existing post as it would be overwritten by the existing post status.
|
|
|
@barryceelen hmmm, i'm not sure that will work. The post status is always sent from the origin post, so your conditional checking for it will always be true for updates. can you give it a test and add a comment describing the behavior you are expecting? |
|
@adamsilverstein The post status was only sent if the 'Draft' checkbox was checked. That meant however that the original post status would not be propagated if it was left unchecked. When updating an origin post its status is not passed to the push function. The previously distributed post's status will thus not be changed. If someone would want the origin post's status to persist across distributed posts, they could use the The behaviour I'm expecting is the same as the one you described above: by default, the post status should not be affected by updates - the post status is controlled on the destination site. The default post status when using |
|
@barryceelen thanks for the update and explanation of your changes. I'll give it a test and review the logic you outlined to verify its accurate.
yea, we can change that - i think this was in place because if you didn't check the 'draft' box on the initial publish the status was supposed to be publish. The logic wasn't fully thought out though, and this PR aims to fix that. |
barryceelen
left a comment
There was a problem hiding this comment.
@adamsilverstein If the dt_drafts_can_be_distributed filter returns true posts with other statuses can still be distributed. The "As draft" checkbox has no effect because the check for $_POST['draft'] has not been reverted yet.
I appreciate this new restriction as an effort to make the application simpler and more understandable.
I think it is fine for folks to want to distribute posts that are scheduled, private, even pending review or draft if they are so inclined. This would now become impossible. To re-enable those statuses for syndication they could be added to the dt_drafts_can_be_distributed filter.
|
@tlovett1 This should be reverted as the "As Draft" will not work as intended. |
|
Hmm, ok let me look. |
|
|
Other than that, FWIW I think the current implementation is technically too restrictive to for other use cases. The same effect can be accomplished with a slightly different pattern while still allowing users to bypass it and pass along the new post status for their own implementation. |
|
^ That fixed it for me. |
|
@barryceelen can you open an issue for making this more extensible? |
Description
Fixes #107.
When distributing posts, we initially set the destination post status based on the user selecting the "As Draft" checkbox:
Subsequent updates to the source post updates the destination post as well, however the post status should not be affected by these updates - the post status is controlled on the destination site. In this PR, when pushing a post to a site where that post already exists, we use its existing status (if we find it) for the update, leaving it unchanged.
Testing