Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better handling of blocks in KnownFollowers #4563

Merged
merged 6 commits into from
Jun 18, 2024
Merged

Conversation

estrattonbailey
Copy link
Member

So the issue here is that there are two count values that matter, length or count:

  • knownFollowers.followers.length
  • knownFollowers.count

followers[] filters out blocks, and only hydrates 5 profiles server-side, so that array could be 0, though it's unlikely. If that ever happened, we'd just not render anything at all.

More likely is followers.length < count because 1 or more profiles are blocked and filtered out.

So rendering should be driven by followers.length, but and N others can only be driven by count since that can be much higher than the 5 max returned on followers.

So the fix here is:

  • determine if we have 1, or more than 1 followers[] to render
  • use the count to determine if we need a , or and
  • use count to determine if we need and N others

Here's a test case illustrating that: we have 3 follows in common, but I block one of them. Note only 2 avis (one is blocked), but it still says and 1 other. Clicking through will only show 2 profiles.
CleanShot 2024-06-18 at 15 06 20@2x

Copy link

render bot commented Jun 18, 2024

Copy link

github-actions bot commented Jun 18, 2024

Old size New size Diff
6.29 MB 6.29 MB 164 B (0.00%)

Copy link
Collaborator

@pfrazee pfrazee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, looks good!

Copy link
Collaborator

@gaearon gaearon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's fix <Trans>

@gaearon gaearon merged commit c92ef2f into main Jun 18, 2024
6 checks passed
@gaearon gaearon deleted the known-followers-fix branch June 18, 2024 22:33
estrattonbailey added a commit that referenced this pull request Jun 20, 2024
* origin/main: (62 commits)
  Rework "Who can reply" to blend more nicely into the UI (#4578)
  Fix threadgate read after write (#4577)
  Convert button to use forwardRef (#4576)
  use 1000x1000 for image height in avatar cropper (#4453)
  fix for autofill covering border (#4573)
  Update HomeHeaderLayoutMobile.tsx (#4572)
  Option for large alt badges (#4571)
  Truncate post metrics and fix truncation on native (#4575)
  Fix avi placeholder layout (#4570)
  add support for `ListEmptyComponent`, allow `undefined` data (#4403)
  GIF previews in notifications (#4447)
  [Session] Convert account to session data explicitly (#4446)
  Move onboarding start to after successfull account creation (#4381)
  Collection of moderation fixes (#4566)
  Fix undefined block (#4479)
  fix gap between tab bar and its border (#4538)
  Better handling of blocks in `KnownFollowers` (#4563)
  Verify email reminders (#4510)
  Bump labeler limit to 20 (#4565)
  Migrate local thread mutes (#4523)
  ...
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.

3 participants