From b39d12f01aff8980023398030fbca1be5bf679f5 Mon Sep 17 00:00:00 2001
From: syuilo <syuilotan@yahoo.co.jp>
Date: Sun, 20 Jan 2019 13:14:31 +0900
Subject: [PATCH] =?UTF-8?q?=E9=96=A2=E4=BF=82=E3=81=AE=E3=81=AA=E3=81=84?=
 =?UTF-8?q?=E8=BF=94=E4=BF=A1=E3=81=8C=E3=82=BF=E3=82=A4=E3=83=A0=E3=83=A9?=
 =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=81=AB=E6=B5=81=E3=82=8C=E3=82=8B=E5=95=8F?=
 =?UTF-8?q?=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Resolve #1910
---
 CHANGELOG.md                                      |  1 +
 src/server/api/endpoints/notes/hybrid-timeline.ts |  3 +++
 src/server/api/endpoints/notes/local-timeline.ts  |  3 +++
 src/services/note/create.ts                       | 10 ++++++++--
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7ab5b1f68d..3d435d52ab 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ unreleased
 * 投稿のツールチップを出すのは時間の上だけに変更
 * ハッシュタグ判定の強化
 * ストーク機能の廃止
+* 関係のない返信がタイムラインに流れる問題を修正
 * クライアントのAPIリクエストをストリーム経由で行うオプションを廃止
 * 一部箇所でカスタム絵文字が適用されていないのを修正
 
diff --git a/src/server/api/endpoints/notes/hybrid-timeline.ts b/src/server/api/endpoints/notes/hybrid-timeline.ts
index c05b88a01b..bb10d5e044 100644
--- a/src/server/api/endpoints/notes/hybrid-timeline.ts
+++ b/src/server/api/endpoints/notes/hybrid-timeline.ts
@@ -168,6 +168,9 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => {
 				// public only
 				visibility: 'public',
 
+				// リプライでない
+				replyId: null,
+
 				// local
 				'_user.host': null
 			}],
diff --git a/src/server/api/endpoints/notes/local-timeline.ts b/src/server/api/endpoints/notes/local-timeline.ts
index fd624c10e6..f9d7b75314 100644
--- a/src/server/api/endpoints/notes/local-timeline.ts
+++ b/src/server/api/endpoints/notes/local-timeline.ts
@@ -96,6 +96,9 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => {
 		// public only
 		visibility: 'public',
 
+		// リプライでない
+		replyId: null,
+
 		// local
 		'_user.host': null
 	} as any;
diff --git a/src/services/note/create.ts b/src/services/note/create.ts
index f8d1c24087..b5e5c4e49c 100644
--- a/src/services/note/create.ts
+++ b/src/services/note/create.ts
@@ -375,11 +375,17 @@ async function publish(user: IUser, note: INote, noteObj: any, reply: INote, ren
 
 			// Publish note to local and hybrid timeline stream
 			if (note.visibility != 'home') {
-				publishLocalTimelineStream(noteObj);
+				// Ignore if it is a reply
+				if (note.replyId == null) {
+					publishLocalTimelineStream(noteObj);
+				}
 			}
 
 			if (note.visibility == 'public') {
-				publishHybridTimelineStream(null, noteObj);
+				// Ignore if it is a reply
+				if (note.replyId == null) {
+					publishHybridTimelineStream(null, noteObj);
+				}
 			} else {
 				// Publish event to myself's stream
 				publishHybridTimelineStream(note.userId, noteObj);