Fix: remove replies to deleted and blocked posts from feeds (#2130)

zio/stable
Paul Frazee 2023-12-07 13:04:22 -08:00 committed by GitHub
parent 972bc1bd88
commit aeafa3a8cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -146,6 +146,19 @@ export class FeedTuner {
): FeedViewPostsSlice[] { ): FeedViewPostsSlice[] {
let slices: FeedViewPostsSlice[] = [] let slices: FeedViewPostsSlice[] = []
// remove posts that are replies, but which don't have the parent
// hydrated. this means the parent was either deleted or blocked
feed = feed.filter(item => {
if (
AppBskyFeedPost.isRecord(item.post.record) &&
item.post.record.reply &&
!item.reply
) {
return false
}
return true
})
if (maintainOrder) { if (maintainOrder) {
slices = feed.map( slices = feed.map(
item => new FeedViewPostsSlice([item], `slice-${this.keyCounter++}`), item => new FeedViewPostsSlice([item], `slice-${this.keyCounter++}`),