From 6ff50f46c728f694f03bcd265b144df62fbaf96a Mon Sep 17 00:00:00 2001 From: Rudy Fraser Date: Thu, 5 Feb 2026 16:29:49 -0500 Subject: [PATCH] Fix replies to community posts resolveReply was using agent.getPost() which only works for app.bsky.feed.post collection. When replying to a community post, it now detects the collection and fetches via getCommunityPost from the appview instead. --- src/lib/api/index.ts | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/lib/api/index.ts b/src/lib/api/index.ts index 5568426b7..76bec2fd6 100644 --- a/src/lib/api/index.ts +++ b/src/lib/api/index.ts @@ -402,6 +402,41 @@ export class ReplyDeletedError extends Error { } async function resolveReply(agent: AtpAgent, replyTo: string) { + const replyToUrip = new AtUri(replyTo) + + // Community posts are fetched from the appview, not the standard feed API. + if (replyToUrip.collection === COMMUNITY_POST_COLLECTION) { + const res = await communityXrpc( + agent, + 'community.blacksky.feed.getCommunityPost', + {params: {uri: replyTo}}, + ) + if (!res.ok) { + logger.error('Failed to fetch parent community post for reply', { + uri: replyTo, + }) + return undefined + } + const data = (await res.json()) as { + post?: { + uri: string + cid: string + replyRoot?: string + replyRootCid?: string + } + } + if (data.post) { + const parentRef = {uri: data.post.uri, cid: data.post.cid} + const rootRef = + data.post.replyRoot && data.post.replyRootCid + ? {uri: data.post.replyRoot, cid: data.post.replyRootCid} + : parentRef + return {root: rootRef, parent: parentRef} + } + return undefined + } + + // Standard Bluesky post const {data} = await agent.app.bsky.feed.getPosts({ uris: [replyTo], }) -- knotmirror 0.0.1