···3535 this.cursor = res.data.cursor
3636 return {
3737 cursor: res.data.cursor,
3838- feed: res.data.feed,
3838+ feed: this._filter(res.data.feed),
3939 }
4040 }
4141 return {
4242 feed: [],
4343 }
4444 }
4545+4646+ _filter(feed: AppBskyFeedDefs.FeedViewPost[]) {
4747+ if (this.params.filter === 'posts_no_replies') {
4848+ return feed.filter(post => {
4949+ const isReply = post.reply
5050+ const isRepost = AppBskyFeedDefs.isReasonRepost(post.reason)
5151+ if (!isReply) return true
5252+ if (isRepost) return true
5353+ return isReply && isAuthorReplyChain(this.params.actor, post, feed)
5454+ })
5555+ }
5656+5757+ return feed
5858+ }
5959+}
6060+6161+function isAuthorReplyChain(
6262+ actor: string,
6363+ post: AppBskyFeedDefs.FeedViewPost,
6464+ posts: AppBskyFeedDefs.FeedViewPost[],
6565+): boolean {
6666+ // current post is by a different user (shouldn't happen)
6767+ if (post.post.author.handle !== actor) return false
6868+6969+ const replyParent = post.reply?.parent
7070+7171+ if (AppBskyFeedDefs.isPostView(replyParent)) {
7272+ // reply parent is by a different user
7373+ if (replyParent.author.handle !== actor) return false
7474+7575+ // A top-level post that matches the parent of the current post.
7676+ const parentPost = posts.find(p => p.post.uri === replyParent.uri)
7777+7878+ /*
7979+ * Either we haven't fetched the parent at the top level, or the only
8080+ * record we have is on feedItem.reply.parent, which we've already checked
8181+ * above.
8282+ */
8383+ if (!parentPost) return true
8484+8585+ // Walk up to parent
8686+ return isAuthorReplyChain(actor, parentPost, posts)
8787+ }
8888+8989+ // Just default to showing it
9090+ return true
4591}