about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-06-10 20:45:23 -0500
committerGitHub <noreply@github.com>2024-06-10 20:45:23 -0500
commit7cac413f3b397fee95681033f075d51c7c4ee153 (patch)
tree83a43b5254d1e45c26c758fe7a866ebc32b3e682 /src
parent212f5750e3f45b6b6f042058c1819ecd92346baa (diff)
downloadvoidsky-7cac413f3b397fee95681033f075d51c7c4ee153.tar.zst
Fix undefined block (#4471)
* Fix undefined block (#4378)

* Fix undefined block

* Changing text and handling all blocks.

* Tweaks

* Hide follow button in hover card if user blocked

---------

Co-authored-by: Josh <hi@oracularhades.com>
Diffstat (limited to 'src')
-rw-r--r--src/components/ProfileHoverCard/index.web.tsx9
-rw-r--r--src/view/com/posts/FeedItem.tsx17
2 files changed, 22 insertions, 4 deletions
diff --git a/src/components/ProfileHoverCard/index.web.tsx b/src/components/ProfileHoverCard/index.web.tsx
index 024867b1a..e85ad0c37 100644
--- a/src/components/ProfileHoverCard/index.web.tsx
+++ b/src/components/ProfileHoverCard/index.web.tsx
@@ -370,7 +370,10 @@ function Inner({
     profile: profileShadow,
     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 followers = formatCount(profile.followersCount || 0)
   const pluralizedFollowers = plural(profile.followersCount || 0, {
@@ -401,7 +404,7 @@ function Inner({
           />
         </Link>
 
-        {!isMe && (
+        {!isMe && !isProfileBlocked && (
           <Button
             size="small"
             color={profileShadow.viewer?.following ? 'secondary' : 'primary'}
@@ -439,7 +442,7 @@ function Inner({
         </View>
       </Link>
 
-      {!blockHide && (
+      {!isProfileBlocked && (
         <>
           <View style={[a.flex_row, a.flex_wrap, a.gap_md, a.pt_xs]}>
             <InlineLinkText
diff --git a/src/view/com/posts/FeedItem.tsx b/src/view/com/posts/FeedItem.tsx
index 675f23a88..9f6dd3322 100644
--- a/src/view/com/posts/FeedItem.tsx
+++ b/src/view/com/posts/FeedItem.tsx
@@ -196,6 +196,12 @@ let FeedItemInner = ({
     },
   ]
 
+  const isParentBlocked = Boolean(
+    parentAuthor?.viewer?.blockedBy ||
+      parentAuthor?.viewer?.blocking ||
+      parentAuthor?.viewer?.blockingByList,
+  )
+
   return (
     <Link
       testID={`feedItem-by-${post.author.handle}`}
@@ -320,7 +326,16 @@ let FeedItemInner = ({
             onOpenAuthor={onOpenAuthor}
           />
           {!isThreadChild && showReplyTo && parentAuthor && (
-            <ReplyToLabel profile={parentAuthor} />
+            <ReplyToLabel
+              profile={
+                isParentBlocked
+                  ? {
+                      ...parentAuthor,
+                      displayName: _(msg`a blocked user`),
+                    }
+                  : parentAuthor
+              }
+            />
           )}
           <LabelsOnMyPost post={post} />
           <PostContent