From 2f48d109ddfc6a9f1e038b973d7011ee11bb4b16 Mon Sep 17 00:00:00 2001
From: syuilo <Syuilotan@yahoo.co.jp>
Date: Sun, 12 Feb 2023 10:59:22 +0900
Subject: [PATCH] enhance(client): make possible to in-channel renote/quote

---
 CHANGELOG.md                                |  1 +
 locales/ja-JP.yml                           |  2 ++
 packages/frontend/src/components/MkNote.vue | 31 +++++++++++++++++++--
 3 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2ce5292040..a9078520fd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ You should also include the user name that made the change.
 - アニメーションを少なくする設定の時、MkPageHeaderのタブアニメーションを無効化
 - Backend: activitypub情報がcorsでブロックされないようヘッダーを追加
 - enhance: レートリミットを0%にできるように
+- チャンネル内Renoteを行えるように
 
 ### Bugfixes
 - Client: ユーザーページでアクティビティを見ることができない問題を修正
diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml
index 14693439b6..99ce82ce4c 100644
--- a/locales/ja-JP.yml
+++ b/locales/ja-JP.yml
@@ -103,6 +103,8 @@ renoted: "Renoteしました。"
 cantRenote: "この投稿はRenoteできません。"
 cantReRenote: "RenoteをRenoteすることはできません。"
 quote: "引用"
+inChannelRenote: "チャンネル内Renote"
+inChannelQuote: "チャンネル内引用"
 pinnedNote: "ピン留めされたノート"
 pinned: "ピン留め"
 you: "あなた"
diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue
index 1bad32c4ac..f50a42ebaf 100644
--- a/packages/frontend/src/components/MkNote.vue
+++ b/packages/frontend/src/components/MkNote.vue
@@ -247,7 +247,32 @@ useTooltip(renoteButton, async (showing) => {
 
 function renote(viaKeyboard = false) {
 	pleaseLogin();
-	os.popupMenu([{
+
+	let items = [];
+
+	if (appearNote.channel) {
+		items = items.concat([{
+			text: i18n.ts.inChannelRenote,
+			icon: 'ti ti-repeat',
+			action: () => {
+				os.api('notes/create', {
+					renoteId: appearNote.id,
+					channelId: appearNote.channelId,
+				});
+			},
+		}, {
+			text: i18n.ts.inChannelQuote,
+			icon: 'ti ti-quote',
+			action: () => {
+				os.post({
+					renote: appearNote,
+					channel: appearNote.channel,
+				});
+			},
+		}, null]);
+	}
+
+	items = items.concat([{
 		text: i18n.ts.renote,
 		icon: 'ti ti-repeat',
 		action: () => {
@@ -263,7 +288,9 @@ function renote(viaKeyboard = false) {
 				renote: appearNote,
 			});
 		},
-	}], renoteButton.value, {
+	}]);
+
+	os.popupMenu(items, renoteButton.value, {
 		viaKeyboard,
 	});
 }