summaryrefslogtreecommitdiff
path: root/src/processor/http/deliver-post.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-04-03 20:13:04 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-04-03 20:13:04 +0900
commitf5a948acaca897fe8fb74c3e9d736d0c6cd50658 (patch)
tree287895b8fcbac240e1ddbeeaf6530057e7331b24 /src/processor/http/deliver-post.ts
parentRefactor (diff)
downloadsharkey-f5a948acaca897fe8fb74c3e9d736d0c6cd50658.tar.gz
sharkey-f5a948acaca897fe8fb74c3e9d736d0c6cd50658.tar.bz2
sharkey-f5a948acaca897fe8fb74c3e9d736d0c6cd50658.zip
Improve readability
Diffstat (limited to 'src/processor/http/deliver-post.ts')
-rw-r--r--src/processor/http/deliver-post.ts23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/processor/http/deliver-post.ts b/src/processor/http/deliver-post.ts
index 1389aede8c..c00ab912c9 100644
--- a/src/processor/http/deliver-post.ts
+++ b/src/processor/http/deliver-post.ts
@@ -25,21 +25,18 @@ export default ({ data }) => Post.findOne({ _id: data.id }).then(post => {
User.findOne({ _id: post.userId }),
// Fetch all followers
- Following.aggregate([
- {
- $lookup: {
- from: 'users',
- localField: 'followerId',
- foreignField: '_id',
- as: 'follower'
- }
- },
- {
+ Following.aggregate([{
+ $lookup: {
+ from: 'users',
+ localField: 'followerId',
+ foreignField: '_id',
+ as: 'follower'
+ }
+ }, {
$match: {
- followeeId: post.userId
- }
+ followeeId: post.userId
}
- ], {
+ }], {
_id: false
})
]).then(([user, followers]) => Promise.all(followers.map(following => {