From 0c5f61721a1f149aeed4a2d7d500b3aa983892b1 Mon Sep 17 00:00:00 2001
From: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
Date: Wed, 26 Nov 2025 13:07:28 +0900
Subject: fix(frontend): フォロー申請のキャンセル時に確認ダイアログを出すように
 (#16834)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* fix(frontend): フォロー申請のキャンセル時に確認ダイアログを出すように

* Update Changelog

* fix: 注釈は書かない
---
 .../frontend/src/components/MkFollowButton.vue     | 72 ++++++++++++----------
 1 file changed, 40 insertions(+), 32 deletions(-)

(limited to 'packages/frontend/src/components/MkFollowButton.vue')

diff --git a/packages/frontend/src/components/MkFollowButton.vue b/packages/frontend/src/components/MkFollowButton.vue
index c7361a19c6..ba21fe82e4 100644
--- a/packages/frontend/src/components/MkFollowButton.vue
+++ b/packages/frontend/src/components/MkFollowButton.vue
@@ -102,6 +102,21 @@ async function onClick() {
 			await misskeyApi('following/delete', {
 				userId: props.user.id,
 			});
+		} else if (hasPendingFollowRequestFromYou.value) {
+			const { canceled } = await os.confirm({
+				type: 'question',
+				text: i18n.tsx.cancelFollowRequestConfirm({ name: props.user.name || props.user.username }),
+			});
+
+			if (canceled) {
+				wait.value = false;
+				return;
+			}
+
+			await misskeyApi('following/requests/cancel', {
+				userId: props.user.id,
+			});
+			hasPendingFollowRequestFromYou.value = false;
 		} else {
 			if (prefer.s.alwaysConfirmFollow) {
 				const { canceled } = await os.confirm({
@@ -115,41 +130,34 @@ async function onClick() {
 				}
 			}
 
-			if (hasPendingFollowRequestFromYou.value) {
-				await misskeyApi('following/requests/cancel', {
-					userId: props.user.id,
-				});
-				hasPendingFollowRequestFromYou.value = false;
-			} else {
-				await misskeyApi('following/create', {
-					userId: props.user.id,
-					withReplies: prefer.s.defaultFollowWithReplies,
-				});
-				emit('update:user', {
-					...props.user,
-					withReplies: prefer.s.defaultFollowWithReplies,
-				});
-				hasPendingFollowRequestFromYou.value = true;
+			await misskeyApi('following/create', {
+				userId: props.user.id,
+				withReplies: prefer.s.defaultFollowWithReplies,
+			});
+			emit('update:user', {
+				...props.user,
+				withReplies: prefer.s.defaultFollowWithReplies,
+			});
+			hasPendingFollowRequestFromYou.value = true;
 
-				if ($i == null) {
-					wait.value = false;
-					return;
-				}
+			if ($i == null) {
+				wait.value = false;
+				return;
+			}
 
-				claimAchievement('following1');
+			claimAchievement('following1');
 
-				if ($i.followingCount >= 10) {
-					claimAchievement('following10');
-				}
-				if ($i.followingCount >= 50) {
-					claimAchievement('following50');
-				}
-				if ($i.followingCount >= 100) {
-					claimAchievement('following100');
-				}
-				if ($i.followingCount >= 300) {
-					claimAchievement('following300');
-				}
+			if ($i.followingCount >= 10) {
+				claimAchievement('following10');
+			}
+			if ($i.followingCount >= 50) {
+				claimAchievement('following50');
+			}
+			if ($i.followingCount >= 100) {
+				claimAchievement('following100');
+			}
+			if ($i.followingCount >= 300) {
+				claimAchievement('following300');
 			}
 		}
 	} catch (err) {
-- 
cgit v1.2.3-freya

