summaryrefslogtreecommitdiff
path: root/src/api/endpoints/posts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-11-06 20:03:50 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-11-06 20:03:50 +0900
commit26d4ebfe1a22615f4f69bf94cc6872659e6e4125 (patch)
tree20ca64e653e7740b5eeb557e418c100303b6ba2b /src/api/endpoints/posts
parent:v: (diff)
downloadsharkey-26d4ebfe1a22615f4f69bf94cc6872659e6e4125.tar.gz
sharkey-26d4ebfe1a22615f4f69bf94cc6872659e6e4125.tar.bz2
sharkey-26d4ebfe1a22615f4f69bf94cc6872659e6e4125.zip
Refactor
Diffstat (limited to 'src/api/endpoints/posts')
-rw-r--r--src/api/endpoints/posts/timeline.ts9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/api/endpoints/posts/timeline.ts b/src/api/endpoints/posts/timeline.ts
index 203413e23a..7af435e82a 100644
--- a/src/api/endpoints/posts/timeline.ts
+++ b/src/api/endpoints/posts/timeline.ts
@@ -34,11 +34,11 @@ module.exports = async (params, user, app) => {
throw 'cannot set since_id and max_id';
}
- const { followingIds, watchChannelIds } = await rap({
+ const { followingIds, watchingChannelIds } = await rap({
// ID list of the user itself and other users who the user follows
followingIds: getFriends(user._id),
// Watchしているチャンネルを取得
- watchChannelIds: ChannelWatching.find({
+ watchingChannelIds: ChannelWatching.find({
user_id: user._id,
// 削除されたドキュメントは除く
deleted_at: { $exists: false }
@@ -67,7 +67,7 @@ module.exports = async (params, user, app) => {
}, {
// Watchしているチャンネルへの投稿
channel_id: {
- $in: watchChannelIds
+ $in: watchingChannelIds
}
}]
} as any;
@@ -92,6 +92,5 @@ module.exports = async (params, user, app) => {
});
// Serialize
- const _timeline = await Promise.all(timeline.map(post => serialize(post, user)));
- return _timeline;
+ return await Promise.all(timeline.map(post => serialize(post, user)));
};