Skip to content

Commit

Permalink
Redo reverted changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwohlbruck committed May 16, 2019
1 parent b4d571a commit 440679c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/routes/fact.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ router.get('/', async (req, res) => {
countUpvotes = [
{$addFields: {
upvotes: { $size: "$upvotes" },
userUpvoted: {
userUpvoted: req.user ? {
$in: [ req.user._id, "$upvotes.user" ]
}
} : undefined
}},
{$sort: {
upvotes: -1
Expand All @@ -81,12 +81,12 @@ router.get('/', async (req, res) => {
projectUpvotes,
...countUpvotes
]),
me: Fact.aggregate([
me: req.user ? Fact.aggregate([
matchMe,
lookupUpvotes,
projectUpvotes,
...countUpvotes
])
]) : undefined
});

return res.status(200).json(data);
Expand Down

0 comments on commit 440679c

Please sign in to comment.