Skip to content

Commit

Permalink
more wip
Browse files Browse the repository at this point in the history
  • Loading branch information
estrattonbailey committed Sep 12, 2023
1 parent 0533fab commit 64576d8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
8 changes: 5 additions & 3 deletions packages/bsky/src/api/app/bsky/feed/getAuthorFeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
27 changes: 23 additions & 4 deletions packages/pds/src/app-view/api/app/bsky/feed/getAuthorFeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
)
}

Expand Down

0 comments on commit 64576d8

Please sign in to comment.