Ticket #7299 (closed defect (bug): fixed)

Opened 6 months ago

Last modified 6 months ago

AtomPub: Draft posts cannot be edited without turning them published

Reported by: redsweater Assigned to: josephscott
Priority: high Milestone: 2.6.1
Component: XML-RPC Version: 2.6
Severity: normal Keywords: has-patch
Cc: redsweater, josephscott

Description

The logic in put_post, in wp-app.php correctly extracts a "publish" or "draft" status for a post by looking for a draft entry in the supplied post. If there is one, and it specifies "yes", then the updated entry should be set to "Unpublished" - otherwise it should be published.

The problem is with some seemingly unnecessary and flawed code which later overrides that determination with some faulty logic:

// let's not go backwards and make something draft again. if(!$publish && $post_status == 'draft') {

$post_status = ($publish) ? 'publish' : 'draft';

} elseif($publish) {

$post_status = 'publish';

}

See how it relies on an unset $post_status field, which hasn't been set in this function. Furthermore, the logic is flawed because in the case where !$publish is true, it goes on to test for ($publish) being true.

I don't think this faulty logic belongs in here at all. What it does in my tests is always overrides the post_status to be 'publish', no matter what the client has specified.

Patch attached to use the basic, good logic as the sole determination for publish status of the post.

Attachments

FixAtomPubDrafts.diff (0.9 kB) - added by redsweater on 07/15/08 04:39:48.

Change History

07/15/08 04:39:48 changed by redsweater

  • attachment FixAtomPubDrafts.diff added.

07/15/08 04:59:12 changed by josephscott

  • cc changed from redsweater to redsweater, josephscott.

07/15/08 20:54:44 changed by redsweater

  • keywords set to has-patch.

07/19/08 15:29:32 changed by westi

  • status changed from new to closed.
  • resolution set to fixed.

(In [8374]) Ensure that AtomPub? does not auto-publish draft posts when they are edited. Fixes #7299 for trunk props redsweater.

07/19/08 15:31:22 changed by westi

  • status changed from closed to reopened.
  • resolution deleted.
  • milestone changed from 2.7 to 2.6.1.

re-opening for 2.6.1

07/19/08 15:31:56 changed by westi

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [8375]) Ensure that AtomPub? does not auto-publish draft posts when they are edited. Fixes #7299 for 2.6.x props redsweater.