From 7049d0f338adaf4dd9df1283b94bcde067bd12ce Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Sun, 26 Jan 2014 12:05:27 +0000 Subject: [PATCH] Improvement for published posts with no published_at issue #2015 - this is another little workaround / improvement to try to reduce the number of people who end up with a published post with no published_at set - I assume we need to complete #1655 to fix this properly --- core/server/models/post.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/server/models/post.js b/core/server/models/post.js index 75b6123841..d525cfd9b6 100644 --- a/core/server/models/post.js +++ b/core/server/models/post.js @@ -61,6 +61,9 @@ Post = ghostBookshelf.Model.extend({ } // This will need to go elsewhere in the API layer. this.set('published_by', 1); + } else if (this.get('status') === 'published' && !this.get('published_at')) { + // If somehow this is a published post with no date, fix it... see #2015 + this.set('published_at', new Date()); } ghostBookshelf.Model.prototype.saving.call(this);