From c24a4db663cbb8066857e4ba0e1c06205e88e5d6 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Thu, 30 Apr 2026 14:03:07 -0400 Subject: [PATCH] web/activity: fix users being sent to wrong board --- web/src/components/dashboard/ActivityList.tsx | 5 ++- web/src/lib/activity.ts | 35 ++++++++++++++----- web/src/pages/Dashboard.tsx | 2 +- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/web/src/components/dashboard/ActivityList.tsx b/web/src/components/dashboard/ActivityList.tsx index 8691cfd..341d811 100644 --- a/web/src/components/dashboard/ActivityList.tsx +++ b/web/src/components/dashboard/ActivityList.tsx @@ -11,10 +11,9 @@ const PAGE_SIZE = 10; interface ActivityListProps { items: ActivityItem[]; - userHandle: string; } -export default function ActivityList({ items, userHandle }: ActivityListProps) { +export default function ActivityList({ items }: ActivityListProps) { const [shown, setShown] = useState(PAGE_SIZE); if (items.length === 0) @@ -25,7 +24,7 @@ export default function ActivityList({ items, userHandle }: ActivityListProps) { {items.slice(0, shown).map((item) => { const { did: threadDid, rkey: threadRkey } = parseAtUri(item.threadUri); const { rkey: replyRkey } = parseAtUri(item.replyUri); - const url = `${threadUrl(userHandle, threadDid, threadRkey)}#reply-${replyRkey}`; + const url = `${threadUrl(item.bbsHandle, threadDid, threadRkey)}#reply-${replyRkey}`; return ( { try { const { records } = await fetchAndHydrate(sourceUri, backlinkSource, { @@ -31,6 +34,7 @@ async function fetchBacklinkItems( type, threadTitle, threadUri, + bbsHandle, replyUri: record.uri, handle: record.handle, body: ((record.value.body as string) ?? "").substring(0, 200), @@ -52,27 +56,40 @@ export async function fetchActivity( const rootPosts = validPosts.filter((record) => !record.value.root); const replyPosts = validPosts.filter((record) => !!record.value.root); + const bbsDids = new Set( + validPosts.map((record) => parseAtUri(record.value.scope).did), + ); + const bbsIdentities = await resolveIdentitiesBatch([...bbsDids]); + const results = await Promise.all([ - ...rootPosts.map((post) => - fetchBacklinkItems( + ...rootPosts.map((post) => { + const bbsDid = parseAtUri(post.value.scope).did; + const bbsHandle = bbsIdentities[bbsDid]?.handle; + if (!bbsHandle) return Promise.resolve([] as ActivityItem[]); + return fetchBacklinkItems( post.uri, `${POST}:root`, did, "reply", post.value.title ?? "", post.uri, - ), - ), - ...replyPosts.map((reply) => - fetchBacklinkItems( + bbsHandle, + ); + }), + ...replyPosts.map((reply) => { + const bbsDid = parseAtUri(reply.value.scope).did; + const bbsHandle = bbsIdentities[bbsDid]?.handle; + if (!bbsHandle) return Promise.resolve([] as ActivityItem[]); + return fetchBacklinkItems( reply.uri, `${POST}:parent`, did, "parent_reply", "", reply.value.root ?? "", - ), - ), + bbsHandle, + ); + }), ]); // Deduplicate — prefer "parent-reply" type when the same reply appears as both. diff --git a/web/src/pages/Dashboard.tsx b/web/src/pages/Dashboard.tsx index c2d59e8..1db0c6f 100644 --- a/web/src/pages/Dashboard.tsx +++ b/web/src/pages/Dashboard.tsx @@ -120,7 +120,7 @@ export default function Dashboard({ user }: DashboardProps) {

Recent replies from other users.

- + )} -- 2.51.2