Skip to content

hide boosts from boost-muted accounts in public feeds - #3331

Open
sneakers-the-rat wants to merge 2 commits into
glitch-soc:mainfrom
NeuromatchAcademy:fix-hide-boosts-in-public-feeds
Open

hide boosts from boost-muted accounts in public feeds#3331
sneakers-the-rat wants to merge 2 commits into
glitch-soc:mainfrom
NeuromatchAcademy:fix-hide-boosts-in-public-feeds

Conversation

@sneakers-the-rat

@sneakers-the-rat sneakers-the-rat commented Jan 5, 2026

Copy link
Copy Markdown

fix: #3330

when one mutes boosts from an account, those boosts were still shown in the public feeds. this fixes that - tries to plug into all existing mechanisms and follow the surrounding patterns so it ends up being pretty small.

the only thing that might be a bit sketch is the cache invalidation - since that's a mixin-like thing, we don't know that we have methods on the Account model, and the other similar methods were on the Account model rather than the interactions concern so i put them there. since we can't be sure we have those methods when we're called, i used the try method - which is a little weird, but this seems like the intended way to use it?

other than that, just adding another where clause to the Status.not_excluded_by_account scope, which seems like the correct place? or at least it's what's used by the public feed manager.

I don't really know how to do crossed behavior/products of test condition in rspec, so sorry if the tests are a bit repetitive. that's the longest part of the PR, hopefully it's readable enough.

Comment on lines +758 to +764
it 'evicts the cache of boost muted accounts' do
expect(me.excluded_boosts_from_timeline_account_ids).to be_empty
me.follow(you, reblogs: false)
expect(me.excluded_boosts_from_timeline_account_ids).to include(you.id)
me.follow(you, reblogs: true)
expect(me.excluded_boosts_from_timeline_account_ids).to be_empty
end

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

i sort of assume the rails cache to be active during tests? but if not, this test needs it enabled, lmk how to do that.

Comment thread app/models/account.rb

# Accounts that are followed but have reblogs hidden
def excluded_boosts_from_timeline_account_ids
Rails.cache.fetch("exclude_boosts_account_ids_for:#{id}", expires_in: 72.hours) do

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

set a max expiration time that shouldn't be too expensive - usually i like to have an upper bound so that caches don't hang around "forever" but it departs from surrounding style.

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.

"show boosts in public timelines" shows boosts from accounts for whom boosts have been muted

1 participant