1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-11-28 14:58:36 +09:00

Improve readability

This commit is contained in:
syuilo 2018-04-03 20:13:04 +09:00
parent 9a6d524d5a
commit f5a948acac

View File

@ -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'
}
},
{
$match: {
followeeId: post.userId
}
Following.aggregate([{
$lookup: {
from: 'users',
localField: 'followerId',
foreignField: '_id',
as: 'follower'
}
], {
}, {
$match: {
followeeId: post.userId
}
}], {
_id: false
})
]).then(([user, followers]) => Promise.all(followers.map(following => {