Fix JavaScript error when editing unpublished post.

fixes #1332