fix: hide blocked user content
This commit is contained in:
@@ -98,6 +98,43 @@ export default function PublicProfileLayout(props: {
|
||||
);
|
||||
}
|
||||
|
||||
// A block in either direction hides this profile's content. The backend
|
||||
// already refuses the feed/mentions/followers endpoints with 403, so this
|
||||
// is the matching client state: keep the header (its action row carries the
|
||||
// Unblock button when *you* blocked them) but replace the tabs + feed with
|
||||
// a notice instead of a misleading empty grid.
|
||||
const rel = data.relationship;
|
||||
const youBlocked = !!rel?.blocked;
|
||||
const theyBlocked = !!rel?.blocked_by;
|
||||
const blocked = youBlocked || theyBlocked;
|
||||
|
||||
if (blocked) {
|
||||
return (
|
||||
<main className="flex-1 max-w-3xl w-full mx-auto px-4 sm:px-6">
|
||||
<ProfileHeader
|
||||
key={data.handle}
|
||||
avatarURL={data.avatar_url}
|
||||
name={data.name}
|
||||
handle={data.handle}
|
||||
followerCount={data.follower_count}
|
||||
followingCount={data.following_count}
|
||||
relationship={data.relationship}
|
||||
enableActions
|
||||
interactiveCounts={false}
|
||||
joinedAt={data.joined_at}
|
||||
country={data.country}
|
||||
/>
|
||||
<div className="py-12 text-center">
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{youBlocked
|
||||
? `You've blocked @${data.handle}. Unblock them to see their posts.`
|
||||
: `@${data.handle}'s posts aren't available.`}
|
||||
</p>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
const tabs: ProfileTab[] = [
|
||||
{
|
||||
href: `/u/${data.handle}`,
|
||||
|
||||
Reference in New Issue
Block a user