Raise the bar a bit more for showing replies in the feed

zio/stable
Paul Frazee 2023-03-21 13:26:13 -05:00
parent 35fae5ab25
commit b692f29773
1 changed files with 4 additions and 3 deletions

View File

@ -28,6 +28,7 @@ export class FeedViewPostsSlice {
get isThread() { get isThread() {
return ( return (
this.items.length > 1 && this.items.length > 1 &&
!this.items[0].reply &&
this.items.every( this.items.every(
item => item.post.author.did === this.items[0].post.author.did, item => item.post.author.did === this.items[0].post.author.did,
) )
@ -35,7 +36,7 @@ export class FeedViewPostsSlice {
} }
get isReply() { get isReply() {
return this.items.length === 2 && !this.isThread return this.items.length > 1 && !this.isThread
} }
get rootItem() { get rootItem() {
@ -180,14 +181,14 @@ export class FeedTuner {
} }
static likedRepliesOnly(tuner: FeedTuner, slices: FeedViewPostsSlice[]) { static likedRepliesOnly(tuner: FeedTuner, slices: FeedViewPostsSlice[]) {
// remove any replies without any likes // remove any replies without at least 2 likes
for (let i = slices.length - 1; i >= 0; i--) { for (let i = slices.length - 1; i >= 0; i--) {
if (slices[i].isThread) { if (slices[i].isThread) {
continue continue
} }
const item = slices[i].rootItem const item = slices[i].rootItem
const isRepost = Boolean(item.reason) const isRepost = Boolean(item.reason)
if (item.reply && !isRepost && item.post.upvoteCount === 0) { if (item.reply && !isRepost && item.post.upvoteCount < 2) {
slices.splice(i, 1) slices.splice(i, 1)
} }
} }