From e5fa7536e083ddf06dbe82f1686c66438b5fb06e Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 12 Dec 2022 10:03:41 +0800 Subject: [PATCH] Prompt to double-confirm unfollow --- src/components/account.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/account.jsx b/src/components/account.jsx index 90f91015..199846bd 100644 --- a/src/components/account.jsx +++ b/src/components/account.jsx @@ -155,11 +155,16 @@ export default ({ account }) => { try { let newRelationship; if (following) { - newRelationship = await masto.accounts.unfollow(id); + const yes = confirm( + 'Are you sure that you want to unfollow this account?', + ); + if (yes) { + newRelationship = await masto.accounts.unfollow(id); + } } else { newRelationship = await masto.accounts.follow(id); } - setRelationship(newRelationship); + if (newRelationship) setRelationship(newRelationship); setRelationshipUIState('default'); } catch (e) { alert(e);