Skip to content

Commit 8bb2059

Browse files
Added profile navigation to blocked user items in ActivityPub (#24564)
ref PROD-2347 - Implemented profile navigation when clicking avatar or name in blocked users list - Enabled quick access to blocked profiles for review or unblocking
1 parent 17a1188 commit 8bb2059

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed

apps/admin-x-activitypub/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tryghost/admin-x-activitypub",
3-
"version": "0.9.13",
3+
"version": "0.9.14",
44
"license": "MIT",
55
"repository": {
66
"type": "git",

apps/admin-x-activitypub/src/views/Preferences/components/Moderation.tsx

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import Layout from '@src/components/layout';
44
import React, {useState} from 'react';
55
import {Account} from '@src/api/activitypub';
66
import {Button, H2, LucideIcon, NoValueLabel, NoValueLabelIcon, Skeleton, Tabs, TabsContent, TabsList, TabsTrigger} from '@tryghost/shade';
7+
import {handleProfileClick} from '@src/utils/handle-profile-click';
78
import {toast} from 'sonner';
89
import {useBlockDomainMutationForUser, useBlockMutationForUser, useBlockedAccountsForUser, useBlockedDomainsForUser, useUnblockDomainMutationForUser, useUnblockMutationForUser} from '@hooks/use-activity-pub-queries';
10+
import {useNavigate} from '@tryghost/admin-x-framework';
911

1012
const Moderation: React.FC = () => {
1113
const {data: blockedAccountsData, isLoading: blockedAccountsLoading} = useBlockedAccountsForUser('index');
@@ -27,6 +29,7 @@ const Moderation: React.FC = () => {
2729
const [unblockedDomainIds, setUnblockedDomainIds] = useState<Set<string>>(new Set());
2830

2931
const [hoveredItemId, setHoveredItemId] = useState<string | null>(null);
32+
const navigate = useNavigate();
3033

3134
const handleUnblock = (account: Account) => {
3235
setUnblockedAccountIds((prev) => {
@@ -98,16 +101,20 @@ const Moderation: React.FC = () => {
98101
</NoValueLabel>
99102
) : (
100103
blockedAccounts.map((account, index) => (
101-
<ActivityItem key={account.apId ? account.apId : `loading-${index}`}>
102-
<APAvatar author={
103-
{
104-
icon: {
105-
url: account.avatarUrl
106-
},
107-
name: account.name,
108-
handle: account.handle
109-
}
110-
} />
104+
<ActivityItem
105+
key={account.apId ? account.apId : `loading-${index}`}
106+
onClick={!blockedAccountsLoading ? () => handleProfileClick(account.handle, navigate) : undefined}
107+
>
108+
<APAvatar
109+
author={
110+
{
111+
icon: {
112+
url: account.avatarUrl
113+
},
114+
name: account.name,
115+
handle: account.handle
116+
}
117+
} />
111118
<div className='flex min-w-0 flex-col'>
112119
<span className='block truncate font-semibold text-black dark:text-white'>{!blockedAccountsLoading ? account.name : <Skeleton className='w-24' />}</span>
113120
<span className='block truncate text-sm text-gray-600'>{!blockedAccountsLoading ? account.handle : <Skeleton className='w-40' />}</span>
@@ -117,7 +124,10 @@ const Moderation: React.FC = () => {
117124
<Button
118125
className='ml-auto min-w-[90px] text-red hover:!bg-red/5 hover:text-red-400'
119126
variant='outline'
120-
onClick={() => handleBlock(account)}
127+
onClick={(e) => {
128+
e.stopPropagation();
129+
handleBlock(account);
130+
}}
121131
>
122132
Block
123133
</Button>
@@ -126,7 +136,10 @@ const Moderation: React.FC = () => {
126136
<Button
127137
className='ml-auto min-w-[90px]'
128138
variant='destructive'
129-
onClick={() => handleUnblock(account)}
139+
onClick={(e) => {
140+
e.stopPropagation();
141+
handleUnblock(account);
142+
}}
130143
onMouseEnter={() => setHoveredItemId(account.apId)}
131144
onMouseLeave={() => setHoveredItemId(null)}
132145
>

0 commit comments

Comments
 (0)