mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-23 09:23:48 +01:00
Refactor
This commit is contained in:
parent
0c787c0a9f
commit
59799c7b19
@ -34,11 +34,11 @@ module.exports = async (params, user, app) => {
|
|||||||
throw 'cannot set since_id and max_id';
|
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
|
// ID list of the user itself and other users who the user follows
|
||||||
followingIds: getFriends(user._id),
|
followingIds: getFriends(user._id),
|
||||||
// Watchしているチャンネルを取得
|
// Watchしているチャンネルを取得
|
||||||
watchChannelIds: ChannelWatching.find({
|
watchingChannelIds: ChannelWatching.find({
|
||||||
user_id: user._id,
|
user_id: user._id,
|
||||||
// 削除されたドキュメントは除く
|
// 削除されたドキュメントは除く
|
||||||
deleted_at: { $exists: false }
|
deleted_at: { $exists: false }
|
||||||
@ -67,7 +67,7 @@ module.exports = async (params, user, app) => {
|
|||||||
}, {
|
}, {
|
||||||
// Watchしているチャンネルへの投稿
|
// Watchしているチャンネルへの投稿
|
||||||
channel_id: {
|
channel_id: {
|
||||||
$in: watchChannelIds
|
$in: watchingChannelIds
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
} as any;
|
} as any;
|
||||||
@ -92,6 +92,5 @@ module.exports = async (params, user, app) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Serialize
|
// Serialize
|
||||||
const _timeline = await Promise.all(timeline.map(post => serialize(post, user)));
|
return await Promise.all(timeline.map(post => serialize(post, user)));
|
||||||
return _timeline;
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user