about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/lib/api/feed-manip.ts27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/lib/api/feed-manip.ts b/src/lib/api/feed-manip.ts
index a0ee647b7..094f892aa 100644
--- a/src/lib/api/feed-manip.ts
+++ b/src/lib/api/feed-manip.ts
@@ -366,11 +366,7 @@ export class FeedTuner {
     ): FeedViewPostsSlice[] => {
       for (let i = 0; i < slices.length; i++) {
         const slice = slices[i]
-        if (
-          slice.isReply &&
-          !slice.isRepost &&
-          !shouldDisplayReplyInFollowing(slice.getAuthors(), userDid)
-        ) {
+        if (slice.isReply && !shouldDisplayReplyInFollowing(slice, userDid)) {
           slices.splice(i, 1)
           i--
         }
@@ -434,9 +430,13 @@ function areSameAuthor(authors: AuthorContext): boolean {
 }
 
 function shouldDisplayReplyInFollowing(
-  authors: AuthorContext,
+  slice: FeedViewPostsSlice,
   userDid: string,
 ): boolean {
+  if (slice.isRepost) {
+    return true
+  }
+  const authors = slice.getAuthors()
   const {author, parentAuthor, grandparentAuthor, rootAuthor} = authors
   if (!isSelfOrFollowing(author, userDid)) {
     // Only show replies from self or people you follow.
@@ -450,6 +450,21 @@ function shouldDisplayReplyInFollowing(
     // Always show self-threads.
     return true
   }
+  if (
+    parentAuthor &&
+    parentAuthor.did !== author.did &&
+    rootAuthor &&
+    rootAuthor.did === author.did &&
+    slice.items.length > 2
+  ) {
+    // If you follow A, show A -> someone[>0 likes] -> A chains too.
+    // This is different from cases below because you only know one person.
+    const parentPost = slice.items[1].post
+    const parentLikeCount = parentPost.likeCount ?? 0
+    if (parentLikeCount > 0) {
+      return true
+    }
+  }
   // From this point on we need at least one more reason to show it.
   if (
     parentAuthor &&