diff --git a/packages/bsky/src/api/app/bsky/feed/getAuthorFeed.ts b/packages/bsky/src/api/app/bsky/feed/getAuthorFeed.ts index 9f25eb131e1..7225134e0fe 100644 --- a/packages/bsky/src/api/app/bsky/feed/getAuthorFeed.ts +++ b/packages/bsky/src/api/app/bsky/feed/getAuthorFeed.ts @@ -99,9 +99,11 @@ export const skeleton = async ( .whereRef('post_embed_image.postUri', '=', 'feed_item.postUri'), ) } else if (filter === 'posts_no_replies') { - feedItemsQb = feedItemsQb.where((qb) => - qb.where('post.replyParent', 'is', null).orWhere('type', '=', 'repost'), - ) + feedItemsQb = feedItemsQb + .where((qb) => + qb.where('post.replyParent', 'is not', null).where('originatorDid', '=', actorDid), + ) + .orWhere((qb) => qb.where('type', '=', 'repost')) } const keyset = new FeedKeyset(ref('feed_item.sortAt'), ref('feed_item.cid')) diff --git a/packages/pds/src/app-view/api/app/bsky/feed/getAuthorFeed.ts b/packages/pds/src/app-view/api/app/bsky/feed/getAuthorFeed.ts index 24f511bf99c..aaf1626d3f0 100644 --- a/packages/pds/src/app-view/api/app/bsky/feed/getAuthorFeed.ts +++ b/packages/pds/src/app-view/api/app/bsky/feed/getAuthorFeed.ts @@ -65,11 +65,30 @@ export default function (server: Server, ctx: AppContext) { ) } else if (params.filter === 'posts_no_replies') { feedItemsQb = feedItemsQb - // only posts, no replies - .where((qb) => + .where('post.replyParent', 'is', null) + .orWhere((qb) => + qb + .where('originatorDid', '=', actorDid) + .where('type', '=', 'repost') + ) + .orWhere((qb) => qb - .where('post.replyParent', 'is', null) - .orWhere('type', '=', 'repost'), + .where('originatorDid', '=', actorDid) + .where('post.replyParent', 'is not', null) + .whereExists(qb => + qb + .selectFrom('post as inner_post') + .whereRef('post.replyParent', '=', 'inner_post.uri') + .where('inner_post.creator', '=', actorDid) + .selectAll() + ) + .whereExists(qb => + qb + .selectFrom('post as inner_post') + .whereRef('post.replyRoot', '=', 'inner_post.uri') + .where('inner_post.creator', '=', actorDid) + .selectAll() + ) ) }