Bug #1210
Posting draft to metaweblog api with blank creation date is saving article as published
| Status : | Closed | Start : | ||
| Priority : | Normal | Due date : | ||
| Assigned to : | scott - | % Done : | 0% |
|
| Category : | backend | |||
| Target version : | - | |||
| Resolution : | fixed |
Description
When posting a draft without specifying dateCreated to a future date, typo is saving the article as published. This is because it sets published_at by default to Time.now, and the state hooks which check the time to determine published status see that the time is before Time.now (even though it's probably milliseconds after) and mark it as published. Changing the order of assignments in
MetaWeblogService#newPostresolves the issue. Patch is attached.
P.S. It might be prudent to advise weblog client authors that to support drafts for older versions they should always send a dateCreated set to Time.now + 300 (now + 5 minutes).