From 77cc11d8a00b3bdb1443d5f6ddb93f7989287e63 Mon Sep 17 00:00:00 2001
From: syuilo <syuilotan@yahoo.co.jp>
Date: Mon, 29 Oct 2018 15:09:03 +0900
Subject: [PATCH] Refactor

---
 src/server/api/endpoints/notes/mentions.ts | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/server/api/endpoints/notes/mentions.ts b/src/server/api/endpoints/notes/mentions.ts
index 7de0102c6..c66421284 100644
--- a/src/server/api/endpoints/notes/mentions.ts
+++ b/src/server/api/endpoints/notes/mentions.ts
@@ -43,7 +43,6 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
 		return rej('cannot set sinceId and untilId');
 	}
 
-	// Construct query
 	const query = {
 		deletedAt: null,
 
@@ -81,15 +80,13 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
 		};
 	}
 
-	// Issue query
 	const mentions = await Note
 		.find(query, {
 			limit: ps.limit,
 			sort: sort
 		});
 
-	mentions.forEach(note => read(user._id, note._id));
-
-	// Serialize
 	res(await packMany(mentions, user));
+
+	mentions.forEach(note => read(user._id, note._id));
 });