From 53f39a388f3a5fb64f92215507ab7079fc4d802d Mon Sep 17 00:00:00 2001
From: syuilo <syuilotan@yahoo.co.jp>
Date: Thu, 6 Sep 2018 04:28:22 +0900
Subject: [PATCH] Improve local timeline API

---
 src/server/api/endpoints/notes/local-timeline.ts | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/server/api/endpoints/notes/local-timeline.ts b/src/server/api/endpoints/notes/local-timeline.ts
index 2458a7055..ce84b4135 100644
--- a/src/server/api/endpoints/notes/local-timeline.ts
+++ b/src/server/api/endpoints/notes/local-timeline.ts
@@ -23,6 +23,12 @@ export const meta = {
 			}
 		}),
 
+		fileType: $.arr($.str).optional.note({
+			desc: {
+				'ja-JP': '指定された種類のファイルが添付された投稿のみを取得します'
+			}
+		}),
+
 		limit: $.num.optional.range(1, 100).note({
 			default: 10
 		}),
@@ -84,6 +90,14 @@ export default async (params: any, user: ILocalUser) => {
 		query.fileIds = { $exists: true, $ne: [] };
 	}
 
+	if (ps.fileType) {
+		query.fileIds = { $exists: true, $ne: [] };
+
+		query['_files.contentType'] = {
+			$in: ps.fileType
+		};
+	}
+
 	if (ps.sinceId) {
 		sort._id = 1;
 		query._id = {