From 15e88d31ad985dfa7fc79e9295b5be6c1d318a47 Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Wed, 25 Jun 2025 16:39:27 -0400 Subject: [PATCH] fix incorrect counts for self-renotes and renotes by bots --- packages/backend/src/core/NoteCreateService.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index 3fee54a308..2c7c8add66 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -646,10 +646,9 @@ export class NoteCreateService implements OnApplicationShutdown { }); } - // TODO move these checks into incRenoteCount - if (this.isPureRenote(data) && data.renote.userId !== user.id && !user.isBot) { + if (this.isPureRenote(data)) { this.collapsedQueueService.updateNoteQueue.enqueue(data.renote.id, { renoteCountDelta: 1 }); - await this.incRenoteCount(data.renote, user) + await this.incRenoteCount(data.renote, user); } if (data.poll && data.poll.expiresAt) { @@ -827,6 +826,9 @@ export class NoteCreateService implements OnApplicationShutdown { // Note: does not increment the count! used only for featured rankings. @bindThis private async incRenoteCount(renote: MiNote, user: MiUser) { + // Moved down from the containing block + if (renote.userId === user.id || user.isBot) return; + // 30%の確率、3日以内に投稿されたノートの場合ハイライト用ランキング更新 if (user.isExplorable && Math.random() < 0.3 && (this.timeService.now - this.idService.parse(renote.id).date.getTime()) < 1000 * 60 * 60 * 24 * 3) { const policies = await this.roleService.getUserPolicies(user);