'Remove follower' menu item
This commit is contained in:
parent
960dff8b9e
commit
e6ba72f4c8
2 changed files with 39 additions and 0 deletions
|
@ -107,4 +107,5 @@ export const ICONS = {
|
||||||
quote: () => import('@iconify-icons/mingcute/quote-left-line'),
|
quote: () => import('@iconify-icons/mingcute/quote-left-line'),
|
||||||
settings: () => import('@iconify-icons/mingcute/settings-6-line'),
|
settings: () => import('@iconify-icons/mingcute/settings-6-line'),
|
||||||
'heart-break': () => import('@iconify-icons/mingcute/heart-crack-line'),
|
'heart-break': () => import('@iconify-icons/mingcute/heart-crack-line'),
|
||||||
|
'user-x': () => import('@iconify-icons/mingcute/user-x-line'),
|
||||||
};
|
};
|
||||||
|
|
|
@ -670,6 +670,7 @@ function AccountInfo({
|
||||||
// states.showAccount = false;
|
// states.showAccount = false;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
states.showGenericAccounts = {
|
states.showGenericAccounts = {
|
||||||
|
id: 'followers',
|
||||||
heading: 'Followers',
|
heading: 'Followers',
|
||||||
fetchAccounts: fetchFollowers,
|
fetchAccounts: fetchFollowers,
|
||||||
instance,
|
instance,
|
||||||
|
@ -1339,6 +1340,43 @@ function RelatedActions({
|
||||||
</div>
|
</div>
|
||||||
</SubMenu>
|
</SubMenu>
|
||||||
)}
|
)}
|
||||||
|
{followedBy && (
|
||||||
|
<MenuConfirm
|
||||||
|
subMenu
|
||||||
|
menuItemClassName="danger"
|
||||||
|
confirmLabel={
|
||||||
|
<>
|
||||||
|
<Icon icon="user-x" />
|
||||||
|
<span>Remove @{username} from followers?</span>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
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');
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon icon="user-x" />
|
||||||
|
<span>Remove follower…</span>
|
||||||
|
</MenuConfirm>
|
||||||
|
)}
|
||||||
<MenuConfirm
|
<MenuConfirm
|
||||||
subMenu
|
subMenu
|
||||||
confirm={!blocking}
|
confirm={!blocking}
|
||||||
|
|
Loading…
Add table
Reference in a new issue