Drafts

I don’t usually feature much of a filter between my mind and my mouth. My keyboard is seldom much better, consequently I am delighted to announce that (while you can’t see it) I finally manged to add a draft system to this blag. Hopefully the post quality will increase soon.

The drafts system as implemented at present is really just a hack on the original post editing mechanism I’ve had for months. I define a draft to be the same datastructure as a post, just stored in a different MongoDB collection. Consequently when you (or anyone else) visits this site drafts are not listed by the server’s database queries. Property 1 of invisibility is satisfied.

Drafts get messy when it comes to the transition back from a published work to an invisible post. Consequently I define a post exclusively as a document which has never been published and provide only the “publish!” operation which moves the record in question from the draft collection to the “deployment” collection. This may change, but is correct for the intended use case of keeping me from saying silly things without thinking abut it a bit first.

The only issue with the system I have devised is the order of posts when transitioned from the draft state to the post state. Obviously, I want posts to appear in the order in which they were posted, not the order in which the drafts from which the posts come were created as the intent of drafts is to provide a holding state where incomplete posts can correctly sit forever if need be. [EDIT] this behavior is now corrected, posts will be timestamped when they were last saved but indexed in the order in which they transition to the post state.

Anyway, that’s all the blagging I’ve got time for today