From 0582c264a9494bf795a857afc38558a9b63de4ba Mon Sep 17 00:00:00 2001
From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com>
Date: Wed, 26 Jun 2024 18:45:36 +0900
Subject: [PATCH] =?UTF-8?q?=E9=9D=9E=E5=85=AC=E9=96=8B=E3=83=8E=E3=83=BC?=
 =?UTF-8?q?=E3=83=88=E3=81=AB=E3=81=AF=E5=9F=8B=E3=82=81=E8=BE=BC=E3=81=BF?=
 =?UTF-8?q?=E3=82=B3=E3=83=BC=E3=83=89=E3=83=9C=E3=82=BF=E3=83=B3=E3=82=92?=
 =?UTF-8?q?=E5=87=BA=E3=81=95=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

---
 .../frontend/src/scripts/get-note-menu.ts     | 29 ++++++++++---------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/packages/frontend/src/scripts/get-note-menu.ts b/packages/frontend/src/scripts/get-note-menu.ts
index 6e7de69cfc..d3f3ada694 100644
--- a/packages/frontend/src/scripts/get-note-menu.ts
+++ b/packages/frontend/src/scripts/get-note-menu.ts
@@ -156,6 +156,19 @@ export function getCopyNoteLinkMenu(note: Misskey.entities.Note, text: string):
 	};
 }
 
+function getNoteEmbedCodeMenu(note: Misskey.entities.Note, text: string): MenuItem | undefined {
+	if (note.url != null || note.uri != null) return undefined;
+	if (['specified', 'followers'].includes(note.visibility)) return undefined;
+
+	return {
+		icon: 'ti ti-code',
+		text,
+		action: (): void => {
+			copyEmbedCode('notes', note.id);
+		},
+	};
+}
+
 export function getNoteMenu(props: {
 	note: Misskey.entities.Note;
 	translation: Ref<Misskey.entities.NotesTranslateResponse | null>;
@@ -316,13 +329,7 @@ export function getNoteMenu(props: {
 				action: () => {
 					window.open(appearNote.url ?? appearNote.uri, '_blank', 'noopener');
 				},
-			} : {
-				icon: 'ti ti-code',
-				text: i18n.ts.copyEmbedCode,
-				action: () => {
-					copyEmbedCode('notes', appearNote.id);
-				},
-			},
+			} : getNoteEmbedCodeMenu(appearNote, i18n.ts.copyEmbedCode),
 			...(isSupportShare() ? [{
 				icon: 'ti ti-share',
 				text: i18n.ts.share,
@@ -462,13 +469,7 @@ export function getNoteMenu(props: {
 			action: () => {
 				window.open(appearNote.url ?? appearNote.uri, '_blank', 'noopener');
 			},
-		} : {
-			icon: 'ti ti-code',
-			text: i18n.ts.copyEmbedCode,
-			action: () => {
-				copyEmbedCode('notes', appearNote.id);
-			},
-		}]
+		} : getNoteEmbedCodeMenu(appearNote, i18n.ts.copyEmbedCode)]
 			.filter(x => x !== undefined);
 	}