From 451a0e3b489930d0a35f4682decce5eb899228a0 Mon Sep 17 00:00:00 2001
From: okayurisotto <okayurisotto@proton.me>
Date: Mon, 3 Jul 2023 06:14:48 +0900
Subject: [PATCH] =?UTF-8?q?refactor(`ApNoteService.ts`):=20=E6=B7=BB?=
 =?UTF-8?q?=E4=BB=98=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../src/core/activitypub/models/ApNoteService.ts      | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/packages/backend/src/core/activitypub/models/ApNoteService.ts b/packages/backend/src/core/activitypub/models/ApNoteService.ts
index 1a05a376d6..f1b8bf43ea 100644
--- a/packages/backend/src/core/activitypub/models/ApNoteService.ts
+++ b/packages/backend/src/core/activitypub/models/ApNoteService.ts
@@ -165,12 +165,13 @@ export class ApNoteService {
 		// 添付ファイル
 		// TODO: attachmentは必ずしもImageではない
 		// TODO: attachmentは必ずしも配列ではない
-		// Noteがsensitiveなら添付もsensitiveにする
 		const limit = promiseLimit<DriveFile>(2);
-
-		note.attachment = toArray(note.attachment);
-		note.attachment.forEach(attach => attach.sensitive = note.sensitive);
-		const files = (await Promise.all(note.attachment.map(x => limit(() => this.apImageService.resolveImage(actor, x)))));
+		const files = (await Promise.all(toArray(note.attachment).map(attach => (
+			limit(() => this.apImageService.resolveImage(actor, {
+				...attach,
+				sensitive: note.sensitive, // Noteがsensitiveなら添付もsensitiveにする
+			}))
+		))));
 
 		// リプライ
 		const reply: Note | null = note.inReplyTo