diff --git a/packages/atproto/context.ts b/packages/atproto/context.ts index 3581115..fa483ca 100644 --- a/packages/atproto/context.ts +++ b/packages/atproto/context.ts @@ -22,7 +22,7 @@ export async function createAtContext() { service: "https://bsky.social", // TODO: look up actual pds persistSession: async (evt, sessionData) => { if (!sessionData) return; - console.log("[atproto] storing session"); + // Storing session await db .insert(appData) .values({ diff --git a/packages/atproto/feeds/handlers/following.ts b/packages/atproto/feeds/handlers/following.ts index cb72b2e..5da92da 100644 --- a/packages/atproto/feeds/handlers/following.ts +++ b/packages/atproto/feeds/handlers/following.ts @@ -5,8 +5,6 @@ import { toCursor } from "../../helpers/cursor"; import { addJob } from "../../worker/add-job"; import { postQuery } from "../queries/post-query"; -const PER_PAGE = 30; - // TODO: This should in fact follow the same interface as the feed handlers export async function followingFeedHandler( args: FeedHandlerArgs diff --git a/packages/atproto/feeds/queries/post-query.ts b/packages/atproto/feeds/queries/post-query.ts index 76fa9ae..860263f 100644 --- a/packages/atproto/feeds/queries/post-query.ts +++ b/packages/atproto/feeds/queries/post-query.ts @@ -43,14 +43,17 @@ export async function postQuery(args: FeedHandlerArgs) { // Posts that we follow // - Maybe subquery for replies so I can look up the author.. or get PSQL to parse the URL and( + isNull(rpls.created), // Not a repost isNotNull(fls.follows), - isNull(rpls.created), - postTable.replyRoot - ? sql`split_part(${postTable.replyRoot}, '/', 3) IN (${fls.follows})` - : undefined, - postTable.replyParent - ? sql`split_part(${postTable.replyParent}, '/', 3) IN (${fls.follows})` - : undefined + or( + // Show only replies if they are replying to someone we follow + postTable?.replyRoot + ? sql`split_part(${postTable.replyRoot}, '/', 3) IN (${fls.follows})` + : undefined, + postTable.replyParent + ? sql`split_part(${postTable.replyParent}, '/', 3) IN (${fls.follows})` + : undefined + ) ), // Reposts by people we follow and(isNotNull(rpls.created))