From bf5952fd63e93894af621828d49ae023ad08ab6a Mon Sep 17 00:00:00 2001
From: FineArchs <133759614+FineArchs@users.noreply.github.com>
Date: Thu, 22 Feb 2024 21:31:57 +0900
Subject: [PATCH] =?UTF-8?q?flash/update=20=E3=81=A7=E9=83=A8=E5=88=86?=
 =?UTF-8?q?=E7=9A=84=E3=81=AB=E5=A4=89=E6=9B=B4=E3=81=A7=E3=81=8D=E3=82=8B?=
 =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B=20(#13396)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* make flash/update params optional

* Update autogen files

pnpm run build-misskey-js-with-types

* Update update.ts

* Update CHANGELOG.md

* hasOwnProperty -> hasOwn

Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>

---------

Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
---
 CHANGELOG.md                                         |  1 +
 .../backend/src/server/api/endpoints/flash/update.ts | 12 ++++++------
 packages/misskey-js/src/autogen/types.ts             |  8 ++++----
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 31dfb6ce11..9ff5881df0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,6 +25,7 @@
 
 ### Server
 - Fix: nodeinfoにenableMcaptchaとenableTurnstileが無いのを修正
+- エンドポイント`flash/update`の`flashId`以外のパラメータは必須ではなくなりました
 - Fix: 禁止キーワードを含むノートがDelayed Queueに追加されて再処理される問題を修正
 
 ## 2024.2.0
diff --git a/packages/backend/src/server/api/endpoints/flash/update.ts b/packages/backend/src/server/api/endpoints/flash/update.ts
index 7d7633daa5..e378669f0a 100644
--- a/packages/backend/src/server/api/endpoints/flash/update.ts
+++ b/packages/backend/src/server/api/endpoints/flash/update.ts
@@ -51,7 +51,7 @@ export const paramDef = {
 		} },
 		visibility: { type: 'string', enum: ['public', 'private'] },
 	},
-	required: ['flashId', 'title', 'summary', 'script', 'permissions'],
+	required: ['flashId'],
 } as const;
 
 @Injectable()
@@ -71,11 +71,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 
 			await this.flashsRepository.update(flash.id, {
 				updatedAt: new Date(),
-				title: ps.title,
-				summary: ps.summary,
-				script: ps.script,
-				permissions: ps.permissions,
-				visibility: ps.visibility,
+				...Object.fromEntries(
+					Object.entries(ps).filter(
+						([key, val]) => (key !== 'flashId') && Object.hasOwn(paramDef.properties, key)
+					)
+				),
 			});
 		});
 	}
diff --git a/packages/misskey-js/src/autogen/types.ts b/packages/misskey-js/src/autogen/types.ts
index 9bf79fde71..0b2a88b537 100644
--- a/packages/misskey-js/src/autogen/types.ts
+++ b/packages/misskey-js/src/autogen/types.ts
@@ -22927,10 +22927,10 @@ export type operations = {
         'application/json': {
           /** Format: misskey:id */
           flashId: string;
-          title: string;
-          summary: string;
-          script: string;
-          permissions: string[];
+          title?: string;
+          summary?: string;
+          script?: string;
+          permissions?: string[];
           /** @enum {string} */
           visibility?: 'public' | 'private';
         };