From eab855ffffcb7e9aae0c5e9a72056dc4fcd5e430 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 21 Mar 2023 13:47:17 -0500 Subject: [PATCH] A few fixes to ensure threads show up as often as possible --- src/lib/api/feed-manip.ts | 9 ++++++--- src/state/models/feed-view.ts | 1 - 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib/api/feed-manip.ts b/src/lib/api/feed-manip.ts index f6b54a17..664bacd8 100644 --- a/src/lib/api/feed-manip.ts +++ b/src/lib/api/feed-manip.ts @@ -28,13 +28,16 @@ export class FeedViewPostsSlice { get isThread() { return ( this.items.length > 1 && - !this.items[0].reply && this.items.every( item => item.post.author.did === this.items[0].post.author.did, ) ) } + get isFullThread() { + return this.isThread && !this.items[0].reply + } + get isReply() { return this.items.length > 1 && !this.isThread } @@ -119,7 +122,7 @@ export class FeedTuner { // remove any items already "seen" const soonToBeSeenUris: Set = new Set() for (let i = slices.length - 1; i >= 0; i--) { - if (this.seenUris.has(slices[i].uri)) { + if (!slices[i].isThread && this.seenUris.has(slices[i].uri)) { slices.splice(i, 1) } else { for (const item of slices[i].items) { @@ -183,7 +186,7 @@ export class FeedTuner { static likedRepliesOnly(tuner: FeedTuner, slices: FeedViewPostsSlice[]) { // remove any replies without at least 2 likes for (let i = slices.length - 1; i >= 0; i--) { - if (slices[i].isThread) { + if (slices[i].isFullThread) { continue } const item = slices[i].rootItem diff --git a/src/state/models/feed-view.ts b/src/state/models/feed-view.ts index 0fbfa515..075016c1 100644 --- a/src/state/models/feed-view.ts +++ b/src/state/models/feed-view.ts @@ -200,7 +200,6 @@ export class FeedSliceModel { get isThread() { return ( this.items.length > 1 && - !this.items[0].reply && this.items.every( item => item.post.author.did === this.items[0].post.author.did, )