Skip to content

Filter blocked replies from post reply counts (by viewer AND post author) #99

Description

@jalcine

Describe the Feature

Currently, post replyCount includes ALL replies regardless of whether the viewer has blocked the reply author or the post author has blocked the reply author. This means blocked accounts can inflate perceived engagement (creating at best - a higher level of content counts and at worse, confusion for folks when viewing content). I'd like to see if counts can be adjusted to reflect only replies the viewer (and post author) actually see - making blocking a bit more complete.

Proposed Solution

I'm thinking that one can use Constellation to:

  1. Fetch distinct reply author DIDs for a post via GET /links/getBacklinks?subject=<postUri>&source=app.bsky.feed.post:reply.root.uri
  2. Check viewer blocks via existing isDidBlocked(queryClient, did) (already cached)
  3. Check post author blocks via Constellation: GET /links/getBacklinks?subject=<authorDid>&source=app.bsky.graph.block:subject and check if any blocked DIDs match reply authors
  4. Update the shadow reference via existing updatePostShadow(postUri, { optimisticReplyCount: correctedCount }) mechanism

Behavior

This should all happen async:

Thread opens -> shows server replyCount immediately
-> Constellation calls fire in background
-> blocked count computed when data arrives
-> shadow updated -> post re-renders with corrected count

No loading state shown to user - count simply "corrects itself" shortly after load (torn on this; perhaps a little spinner somewhere in the post).

Fallback

If Constellation returns no data (incomplete backfill, network timing out), we should opt to fall back to enumerating thread via getPostThread and checking blocks directly (we could get around this - a lot of it, if this is computed on the PDS or in https://github.com/blacksky-algorithms/atproto.

Technical Notes

  • Uses existing mergeShadow() (optimisticReplyCount)
  • Constellation is public instance at constellation.microcosm.blue
  • Block lists are session-cached; first view may show uncorrected counts until cache warms (hence the need for a spinner somewhere to indicate some extra data fetching)
  • Block filtering is (viewer+poster)-specific; does not affect other users' counts (this does lead, eventually, to an experience where counts aren't consistent; my biggest concern if these numbers are important)

Attachments

No response

Describe Alternatives

No response

Additional Context

Reference

The author (did:plc:p5yoyqfwr7hmazdjde632lvd) has 188 blocked accounts. When viewing their post (3mmpwv7k3sc2y), if one of those blocked accounts replied, the reply should be excluded from the displayed replyCount for both the viewer and the post author; that's currently not the case.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions