From 4a595153dc3a82206c5ee1c05a12deab663ba544 Mon Sep 17 00:00:00 2001
From: syuilo <Syuilotan@yahoo.co.jp>
Date: Sat, 7 Oct 2023 07:53:14 +0900
Subject: [PATCH] =?UTF-8?q?enhance(backend):=20=E8=BF=94=E4=BF=A1=E3=81=AF?=
 =?UTF-8?q?=E3=83=8F=E3=82=A4=E3=83=A9=E3=82=A4=E3=83=88=E3=81=AB=E8=BC=89?=
 =?UTF-8?q?=E3=82=89=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 packages/backend/src/core/NoteCreateService.ts | 12 ++++++++----
 packages/backend/src/core/ReactionService.ts   | 12 ++++++++----
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts
index b6fc4b3c49..5e86443945 100644
--- a/packages/backend/src/core/NoteCreateService.ts
+++ b/packages/backend/src/core/NoteCreateService.ts
@@ -729,10 +729,14 @@ export class NoteCreateService implements OnApplicationShutdown {
 		// 30%の確率でハイライト用ランキング更新
 		if (Math.random() < 0.3) {
 			if (renote.channelId != null) {
-				this.featuredService.updateInChannelNotesRanking(renote.channelId, renote.id, 5);
-			} else if (renote.visibility === 'public' && renote.userHost == null) {
-				this.featuredService.updateGlobalNotesRanking(renote.id, 5);
-				this.featuredService.updatePerUserNotesRanking(renote.userId, renote.id, 5);
+				if (renote.replyId == null) {
+					this.featuredService.updateInChannelNotesRanking(renote.channelId, renote.id, 5);
+				}
+			} else {
+				if (renote.visibility === 'public' && renote.userHost == null && renote.replyId == null) {
+					this.featuredService.updateGlobalNotesRanking(renote.id, 5);
+					this.featuredService.updatePerUserNotesRanking(renote.userId, renote.id, 5);
+				}
 			}
 		}
 	}
diff --git a/packages/backend/src/core/ReactionService.ts b/packages/backend/src/core/ReactionService.ts
index 63cf4be322..86213e4576 100644
--- a/packages/backend/src/core/ReactionService.ts
+++ b/packages/backend/src/core/ReactionService.ts
@@ -195,10 +195,14 @@ export class ReactionService {
 		// 30%の確率でハイライト用ランキング更新
 		if (Math.random() < 0.3 && note.userId !== user.id) {
 			if (note.channelId != null) {
-				this.featuredService.updateInChannelNotesRanking(note.channelId, note.id, 1);
-			} else if (note.visibility === 'public' && note.userHost == null) {
-				this.featuredService.updateGlobalNotesRanking(note.id, 1);
-				this.featuredService.updatePerUserNotesRanking(note.userId, note.id, 1);
+				if (note.replyId == null) {
+					this.featuredService.updateInChannelNotesRanking(note.channelId, note.id, 1);
+				}
+			} else {
+				if (note.visibility === 'public' && note.userHost == null && note.replyId == null) {
+					this.featuredService.updateGlobalNotesRanking(note.id, 1);
+					this.featuredService.updatePerUserNotesRanking(note.userId, note.id, 1);
+				}
 			}
 		}