From e6eb1b2ae1c38b335ff4755d35a33a0ca4450454 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 19 May 2018 07:33:34 +0900 Subject: Clean up --- src/server/api/endpoints/notes/timeline.ts | 33 ++++-------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) (limited to 'src/server/api/endpoints/notes/timeline.ts') 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 -- cgit v1.2.3-freya