diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-04-03 20:13:04 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-04-03 20:13:04 +0900 |
| commit | f5a948acaca897fe8fb74c3e9d736d0c6cd50658 (patch) | |
| tree | 287895b8fcbac240e1ddbeeaf6530057e7331b24 /src/processor | |
| parent | Refactor (diff) | |
| download | sharkey-f5a948acaca897fe8fb74c3e9d736d0c6cd50658.tar.gz sharkey-f5a948acaca897fe8fb74c3e9d736d0c6cd50658.tar.bz2 sharkey-f5a948acaca897fe8fb74c3e9d736d0c6cd50658.zip | |
Improve readability
Diffstat (limited to 'src/processor')
| -rw-r--r-- | src/processor/http/deliver-post.ts | 23 |
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 => { |