Tweak feed manip to show cases of A -> B without further children (#4883)

zio/stable
Hailey 2024-08-06 11:21:59 -07:00 committed by GitHub
parent 5845e08eee
commit 753a233408
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 8 deletions

View File

@ -428,32 +428,34 @@ function shouldDisplayReplyInFollowing(
// Only show replies from self or people you follow. // Only show replies from self or people you follow.
return false return false
} }
if (!parentAuthor || !grandparentAuthor || !rootAuthor) {
// Don't surface orphaned reply subthreads.
return false
}
if ( if (
parentAuthor.did === author.did && (!parentAuthor || parentAuthor.did === author.did) &&
grandparentAuthor.did === author.did && (!rootAuthor || rootAuthor.did === author.did) &&
rootAuthor.did === author.did (!grandparentAuthor || grandparentAuthor.did === author.did)
) { ) {
// Always show self-threads. // Always show self-threads.
return true return true
} }
// From this point on we need at least one more reason to show it. // From this point on we need at least one more reason to show it.
if ( if (
parentAuthor &&
parentAuthor.did !== author.did && parentAuthor.did !== author.did &&
isSelfOrFollowing(parentAuthor, userDid) isSelfOrFollowing(parentAuthor, userDid)
) { ) {
return true return true
} }
if ( if (
grandparentAuthor &&
grandparentAuthor.did !== author.did && grandparentAuthor.did !== author.did &&
isSelfOrFollowing(grandparentAuthor, userDid) isSelfOrFollowing(grandparentAuthor, userDid)
) { ) {
return true return true
} }
if (rootAuthor.did !== author.did && isSelfOrFollowing(rootAuthor, userDid)) { if (
rootAuthor &&
rootAuthor.did !== author.did &&
isSelfOrFollowing(rootAuthor, userDid)
) {
return true return true
} }
return false return false