diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-05-19 07:33:34 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-05-19 07:33:34 +0900 |
| commit | e6eb1b2ae1c38b335ff4755d35a33a0ca4450454 (patch) | |
| tree | f10a35f91071e36f787f77c242b127b7ad01c416 /src/server/api/endpoints/notes/timeline.ts | |
| parent | Fix (diff) | |
| download | sharkey-e6eb1b2ae1c38b335ff4755d35a33a0ca4450454.tar.gz sharkey-e6eb1b2ae1c38b335ff4755d35a33a0ca4450454.tar.bz2 sharkey-e6eb1b2ae1c38b335ff4755d35a33a0ca4450454.zip | |
Clean up
Diffstat (limited to 'src/server/api/endpoints/notes/timeline.ts')
| -rw-r--r-- | src/server/api/endpoints/notes/timeline.ts | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/src/server/api/endpoints/notes/timeline.ts b/src/server/api/endpoints/notes/timeline.ts index 78786d4a16..9f32555649 100644 --- a/src/server/api/endpoints/notes/timeline.ts +++ b/src/server/api/endpoints/notes/timeline.ts @@ -4,7 +4,6 @@ import $ from 'cafy'; import ID from '../../../../cafy-id'; import Note from '../../../../models/note'; import Mute from '../../../../models/mute'; -import ChannelWatching from '../../../../models/channel-watching'; import { getFriends } from '../../common/get-friends'; import { pack } from '../../../../models/note'; @@ -45,18 +44,11 @@ module.exports = async (params, user, app) => { const [includeRenotedMyNotes = true, includeRenotedMyNotesErr] = $.bool.optional().get(params.includeRenotedMyNotes); if (includeRenotedMyNotesErr) throw 'invalid includeRenotedMyNotes param'; - const [followings, watchingChannelIds, mutedUserIds] = await Promise.all([ + const [followings, mutedUserIds] = await Promise.all([ // フォローを取得 // Fetch following getFriends(user._id), - // Watchしているチャンネルを取得 - ChannelWatching.find({ - userId: user._id, - // 削除されたドキュメントは除く - deletedAt: { $exists: false } - }).then(watches => watches.map(w => w.channelId)), - // ミュートしているユーザーを取得 Mute.find({ muterId: user._id @@ -93,26 +85,9 @@ module.exports = async (params, user, app) => { const query = { $and: [{ - $or: [{ - $and: [{ - // フォローしている人のタイムラインへの投稿 - $or: followQuery - }, { - // 「タイムラインへの」投稿に限定するためにチャンネルが指定されていないもののみに限る - $or: [{ - channelId: { - $exists: false - } - }, { - channelId: null - }] - }] - }, { - // Watchしているチャンネルへの投稿 - channelId: { - $in: watchingChannelIds - } - }], + // フォローしている人の投稿 + $or: followQuery, + // mute userId: { $nin: mutedUserIds |