From ab7bbd4e579743e2c47885d89778dad3ed694d9f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=93=E3=81=8B=E3=82=8A?=
 <67428053+kakkokari-gtyih@users.noreply.github.com>
Date: Sun, 11 Aug 2024 16:27:08 +0900
Subject: [PATCH] =?UTF-8?q?fix(backend):=20=E3=83=80=E3=82=A4=E3=83=AC?=
 =?UTF-8?q?=E3=82=AF=E3=83=88=E6=8A=95=E7=A8=BF=E3=82=92=E3=83=A6=E3=83=BC?=
 =?UTF-8?q?=E3=82=B6=E3=83=BC=E3=81=94=E3=81=A8=E3=81=AE=E3=83=81=E3=83=A3?=
 =?UTF-8?q?=E3=83=BC=E3=83=88=E3=81=8B=E3=82=89=E9=99=A4=E5=A4=96=20(#1435?=
 =?UTF-8?q?0)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* fix(chart): ダイレクト投稿をユーザーごとのチャートから除外 (MisskeyIO#679)

(cherry picked from commit 3db41c2d829ac18daabbdf52fe6235a874735b31)

* Update Changelog

---------

Co-authored-by: Yuuki <yukikum57@gmail.com>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
---
 CHANGELOG.md                                   | 2 ++
 packages/backend/src/core/NoteCreateService.ts | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index bb58f733b5..8468afe795 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,8 @@
 - Fix: Play各種エンドポイントの返り値に`visibility`が含まれていない問題を修正
 - Fix: サーバー情報取得の際にモデレーター限定の情報が取得できないことがあるのを修正  
   (Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/582)
+- Fix: 公開範囲がダイレクトのノートをユーザーアクティビティのチャート生成に使用しないように  
+  (Cherry-picked from https://github.com/MisskeyIO/misskey/pull/679)
 - Fix: ActivityPubのエンティティタイプ判定で不明なタイプを受け取った場合でも処理を継続するように
   - キュー処理のつまりが改善される可能性があります
 
diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts
index 32cf3f3e26..1d8d248322 100644
--- a/packages/backend/src/core/NoteCreateService.ts
+++ b/packages/backend/src/core/NoteCreateService.ts
@@ -509,7 +509,7 @@ export class NoteCreateService implements OnApplicationShutdown {
 		const meta = await this.metaService.fetch();
 
 		this.notesChart.update(note, true);
-		if (meta.enableChartsForRemoteUser || (user.host == null)) {
+		if (note.visibility !== 'specified' && (meta.enableChartsForRemoteUser || (user.host == null))) {
 			this.perUserNotesChart.update(user, note, true);
 		}