From f4c4f9261f825cbc710340316f4cc19cd0c9deb3 Mon Sep 17 00:00:00 2001 From: Sacha Greif Date: Mon, 25 Jul 2016 10:46:43 +0900 Subject: [PATCH] test for postedAt (for pending posts) --- packages/nova-posts/lib/callbacks.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nova-posts/lib/callbacks.js b/packages/nova-posts/lib/callbacks.js index 333773a38..fad9f402c 100644 --- a/packages/nova-posts/lib/callbacks.js +++ b/packages/nova-posts/lib/callbacks.js @@ -224,7 +224,7 @@ Telescope.callbacks.add("posts.new.sync", PostsNewRequiredPropertiesCheck); * @summary Set the post's isFuture to true if necessary */ function PostsNewSetFuture (post, user) { - post.isFuture = post.postedAt.getTime() > post.createdAt.getTime() + 1000; // round up to the second + post.isFuture = post.postedAt && post.postedAt.getTime() > post.createdAt.getTime() + 1000; // round up to the second return post; } Telescope.callbacks.add("posts.new.sync", PostsNewSetFuture); @@ -331,7 +331,7 @@ Telescope.callbacks.add("posts.edit.sync", PostsEditForceStickyToFalse); */ function PostsEditSetIsFuture (modifier, post) { // if a post's postedAt date is in the future, set isFuture to true - modifier.$set.isFuture = modifier.$set.postedAt.getTime() > new Date().getTime() + 1000; + modifier.$set.isFuture = modifier.$set.postedAt && modifier.$set.postedAt.getTime() > new Date().getTime() + 1000; return modifier; } Telescope.callbacks.add("posts.edit.sync", PostsEditSetIsFuture);