about summary refs log tree commit diff
path: root/src/lib/api
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-08-06 11:21:59 -0700
committerGitHub <noreply@github.com>2024-08-06 11:21:59 -0700
commit753a2334082d279b504e164a1f50c0b0a8169f2b (patch)
treedd49b24533573345ced9e1e959d9e055298d6979 /src/lib/api
parent5845e08eeea151deb75bb21ceaa33f7a973870e3 (diff)
downloadvoidsky-753a2334082d279b504e164a1f50c0b0a8169f2b.tar.zst
Tweak feed manip to show cases of A -> B without further children (#4883)
Diffstat (limited to 'src/lib/api')
-rw-r--r--src/lib/api/feed-manip.ts18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/lib/api/feed-manip.ts b/src/lib/api/feed-manip.ts
index ae3e84b99..61de795a1 100644
--- a/src/lib/api/feed-manip.ts
+++ b/src/lib/api/feed-manip.ts
@@ -428,32 +428,34 @@ function shouldDisplayReplyInFollowing(
     // Only show replies from self or people you follow.
     return false
   }
-  if (!parentAuthor || !grandparentAuthor || !rootAuthor) {
-    // Don't surface orphaned reply subthreads.
-    return false
-  }
   if (
-    parentAuthor.did === author.did &&
-    grandparentAuthor.did === author.did &&
-    rootAuthor.did === author.did
+    (!parentAuthor || parentAuthor.did === author.did) &&
+    (!rootAuthor || rootAuthor.did === author.did) &&
+    (!grandparentAuthor || grandparentAuthor.did === author.did)
   ) {
     // Always show self-threads.
     return true
   }
   // From this point on we need at least one more reason to show it.
   if (
+    parentAuthor &&
     parentAuthor.did !== author.did &&
     isSelfOrFollowing(parentAuthor, userDid)
   ) {
     return true
   }
   if (
+    grandparentAuthor &&
     grandparentAuthor.did !== author.did &&
     isSelfOrFollowing(grandparentAuthor, userDid)
   ) {
     return true
   }
-  if (rootAuthor.did !== author.did && isSelfOrFollowing(rootAuthor, userDid)) {
+  if (
+    rootAuthor &&
+    rootAuthor.did !== author.did &&
+    isSelfOrFollowing(rootAuthor, userDid)
+  ) {
     return true
   }
   return false