Skip to content

Commit

Permalink
filters list by date for prerelease stories
Browse files Browse the repository at this point in the history
  • Loading branch information
jhmullen committed Sep 20, 2021
1 parent 4c86f09 commit d4f2b86
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/cms/src/api/mortarRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,10 @@ module.exports = function(app) {
{association: "content", attributes: ["name", "title", "image", "twitter", "bio", "locale"]}
]}
]}).catch(catcher);
stories = stories.map(story => extractLocaleContent(story.toJSON(), locale, "story"));
const now = Date.now();
stories = stories
.map(story => extractLocaleContent(story.toJSON(), locale, "story"))
.filter(story => story.date < now);
return res.json(stories.sort(sorter));
});

Expand Down

0 comments on commit d4f2b86

Please sign in to comment.