Revert "Revert "Fix undefined block (#4471)" (#4472)"

This reverts commit 848151c4f9.
This commit is contained in:
dan
2024-06-11 03:52:05 +02:00
committed by GitHub
parent 848151c4f9
commit 4ec555d172
2 changed files with 22 additions and 4 deletions
@@ -370,7 +370,10 @@ function Inner({
profile: profileShadow, profile: profileShadow,
logContext: 'ProfileHoverCard', logContext: 'ProfileHoverCard',
}) })
const blockHide = profile.viewer?.blocking || profile.viewer?.blockedBy const isProfileBlocked =
profile.viewer?.blocking ||
profile.viewer?.blockedBy ||
profile.viewer?.blockingByList
const following = formatCount(profile.followsCount || 0) const following = formatCount(profile.followsCount || 0)
const followers = formatCount(profile.followersCount || 0) const followers = formatCount(profile.followersCount || 0)
const pluralizedFollowers = plural(profile.followersCount || 0, { const pluralizedFollowers = plural(profile.followersCount || 0, {
@@ -401,7 +404,7 @@ function Inner({
/> />
</Link> </Link>
{!isMe && ( {!isMe && !isProfileBlocked && (
<Button <Button
size="small" size="small"
color={profileShadow.viewer?.following ? 'secondary' : 'primary'} color={profileShadow.viewer?.following ? 'secondary' : 'primary'}
@@ -439,7 +442,7 @@ function Inner({
</View> </View>
</Link> </Link>
{!blockHide && ( {!isProfileBlocked && (
<> <>
<View style={[a.flex_row, a.flex_wrap, a.gap_md, a.pt_xs]}> <View style={[a.flex_row, a.flex_wrap, a.gap_md, a.pt_xs]}>
<InlineLinkText <InlineLinkText
+16 -1
View File
@@ -196,6 +196,12 @@ let FeedItemInner = ({
}, },
] ]
const isParentBlocked = Boolean(
parentAuthor?.viewer?.blockedBy ||
parentAuthor?.viewer?.blocking ||
parentAuthor?.viewer?.blockingByList,
)
return ( return (
<Link <Link
testID={`feedItem-by-${post.author.handle}`} testID={`feedItem-by-${post.author.handle}`}
@@ -320,7 +326,16 @@ let FeedItemInner = ({
onOpenAuthor={onOpenAuthor} onOpenAuthor={onOpenAuthor}
/> />
{!isThreadChild && showReplyTo && parentAuthor && ( {!isThreadChild && showReplyTo && parentAuthor && (
<ReplyToLabel profile={parentAuthor} /> <ReplyToLabel
profile={
isParentBlocked
? {
...parentAuthor,
displayName: _(msg`a blocked user`),
}
: parentAuthor
}
/>
)} )}
<LabelsOnMyPost post={post} /> <LabelsOnMyPost post={post} />
<PostContent <PostContent