From e6ba72f4c8fec8551eafc1b76fa7b27c7e910a63 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Wed, 3 Apr 2024 11:54:46 +0800 Subject: [PATCH] 'Remove follower' menu item --- src/components/ICONS.jsx | 1 + src/components/account-info.jsx | 38 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/components/ICONS.jsx b/src/components/ICONS.jsx index dfbb164c..4ab8b8d3 100644 --- a/src/components/ICONS.jsx +++ b/src/components/ICONS.jsx @@ -107,4 +107,5 @@ export const ICONS = { quote: () => import('@iconify-icons/mingcute/quote-left-line'), settings: () => import('@iconify-icons/mingcute/settings-6-line'), 'heart-break': () => import('@iconify-icons/mingcute/heart-crack-line'), + 'user-x': () => import('@iconify-icons/mingcute/user-x-line'), }; diff --git a/src/components/account-info.jsx b/src/components/account-info.jsx index 7fc31559..1f6cc824 100644 --- a/src/components/account-info.jsx +++ b/src/components/account-info.jsx @@ -670,6 +670,7 @@ function AccountInfo({ // states.showAccount = false; setTimeout(() => { states.showGenericAccounts = { + id: 'followers', heading: 'Followers', fetchAccounts: fetchFollowers, instance, @@ -1339,6 +1340,43 @@ function RelatedActions({ )} + {followedBy && ( + + + Remove @{username} from followers? + + } + onClick={() => { + setRelationshipUIState('loading'); + (async () => { + try { + const newRelationship = await currentMasto.v1.accounts + .$select(currentInfo?.id || id) + .removeFromFollowers(); + console.log( + 'removing from followers', + newRelationship, + ); + setRelationship(newRelationship); + setRelationshipUIState('default'); + showToast(`@${username} removed from followers`); + states.reloadGenericAccounts.id = 'followers'; + states.reloadGenericAccounts.counter++; + } catch (e) { + console.error(e); + setRelationshipUIState('error'); + } + })(); + }} + > + + Remove follower… + + )}