From 00a3f8d3929c55a165f6f00877c847162139d5c6 Mon Sep 17 00:00:00 2001
From: syuilo <syuilotan@yahoo.co.jp>
Date: Fri, 21 Sep 2018 08:37:26 +0900
Subject: [PATCH] Fix #2741

---
 src/services/note/unread.ts | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/services/note/unread.ts b/src/services/note/unread.ts
index 6e10c8b248..2d50976283 100644
--- a/src/services/note/unread.ts
+++ b/src/services/note/unread.ts
@@ -5,6 +5,14 @@ import Mute from '../../models/mute';
 import { publishUserStream } from '../../stream';
 
 export default async function(user: IUser, note: INote, isSpecified = false) {
+	//#region ミュートしているなら無視
+	const mute = await Mute.find({
+		muterId: user._id
+	});
+	const mutedUserIds = mute.map(m => m.muteeId.toString());
+	if (mutedUserIds.includes(note.userId.toString())) return;
+	//#endregion
+
 	const unread = await NoteUnread.insert({
 		noteId: note._id,
 		userId: user._id,
@@ -19,14 +27,6 @@ export default async function(user: IUser, note: INote, isSpecified = false) {
 		const exist = await NoteUnread.findOne({ _id: unread._id });
 		if (exist == null) return;
 
-		//#region ただしミュートされているなら発行しない
-		const mute = await Mute.find({
-			muterId: user._id
-		});
-		const mutedUserIds = mute.map(m => m.muteeId.toString());
-		if (mutedUserIds.includes(note.userId.toString())) return;
-		//#endregion
-
 		User.update({
 			_id: user._id
 		}, {