fix pending view bug by including posts without a postedAt property as well

This commit is contained in:
Sacha Greif 2014-12-06 18:06:51 +09:00
parent 2def10822a
commit 242bf4e783
2 changed files with 8 additions and 2 deletions

View file

@ -10,7 +10,10 @@ getPostsParameters = function (terms) {
var baseParameters = {
find: {
status: STATUS_APPROVED,
postedAt: {$lte: new Date()} // only show posts in the past
$or: [
{postedAt: {$lte: new Date()}}, // only show posts if they're in the past
{postedAt: {$exists: false}} // or if they don't have a "postedAt" date (i.e. pending posts)
]
},
options: {
limit: 10

View file

@ -90,7 +90,10 @@ viewParameters.pending = function (terms) {
return {
find: {
status: 1,
postedAt: {$lte: new Date("December 31, 2999")} // for pending view, show future posts too
$or: [
{postedAt: {$lte: new Date("December 31, 2999")}},
{postedAt: {$exists: false}}
] // for pending view, show future posts too
},
options: {sort: {createdAt: -1}}
};