Skip to content

Add profile navigation from feed cards and thread detail - #66

Merged
MikeBlakeway merged 3 commits into
mainfrom
feat/TRB-049
Apr 20, 2026
Merged

Add profile navigation from feed cards and thread detail#66
MikeBlakeway merged 3 commits into
mainfrom
feat/TRB-049

Conversation

@MikeBlakeway

Copy link
Copy Markdown
Owner

TRB-049: Feed Profile Navigation

Clicking an author avatar or handle anywhere in the feed now navigates to /profile/[username]. This required enriching the feed and post API responses with author username data.

Changes

API

  • enrichOrganicItemsWithAuthors() added to feed generation — bulk-fetches usernames in a single round-trip and attaches author: { id, username } to each feed item
  • Feed (GET /api/v1/feed) and thread detail (GET /api/v1/posts/:id) now include author.username in the response
  • packages/shared feed types extended with optional author field

Web

  • FeedPost avatar and handle are wrapped in a conditional <Link href="/profile/[username]"> with stopPropagation to prevent card-level click conflicts
  • FeedPostDetailPage (thread detail) author header similarly linked
  • ExploreToggleButton and ReportModal destructuring cleaned up to prevent line-length lint failures

Bug fixes

  • followUser in apps/web/src/lib/api/users.ts was sending Content-Type: application/json with no body, causing Fastify to return 400 FST_ERR_CTP_EMPTY_JSON_BODY. Removed the redundant header.
  • Compass follow count not updating: GET /me now reconciles follows from user_follows when user_signal_counts is stale; incrementSignalCounts detects and patches a silent RPC shortfall for p_follows.

Test coverage

  • 13 new tests across feed generation, feed route, posts route, and FeedPost component
  • recordBehaviorEvents mock + 3 follow-route behavior event assertions added to users.test.ts
  • ingest.test.ts extended with follow-shortfall detection coverage

- Add author?: { id, username } to BasePostFeedItem in shared types
- Bulk-fetch usernames in enrichOrganicItemsWithAuthors after scoring; omit field when unresolvable
- Extend organicPostBaseSchema and postResponseSchema with required author sub-object
- Enrich GET /api/v1/posts/:postId response with author via maybeSingle users lookup
- Stop ExploreToggleButton and ReportModal clicks propagating to card navigation
- Wrap feed card avatar in profile Link with stopPropagation when username available
- Link thread detail author handle and avatar to /profile/[username] when enriched
- Add 11 new tests covering propagation, avatar linking, and thread header profile link
- Reconcile follows in GET /me from user_follows when user_signal_counts is stale (best-effort, non-fatal)
- Detect and patch follows shortfall in incrementSignalCounts when RPC succeeds but silently skips p_follows
- Add recordBehaviorEvents mock and follow-route behavior event tests to users.test.ts
- Add ingest.test.ts coverage for follow shortfall detection path
- Remove spurious Content-Type header from followUser fetch (no request body)
@MikeBlakeway
MikeBlakeway merged commit ef14e9a into main Apr 20, 2026
6 checks passed
@MikeBlakeway
MikeBlakeway deleted the feat/TRB-049 branch April 20, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant