Skip to content

Commit

Permalink
Fix boosts of local users being filtered in account timelines (#27204)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire committed Oct 6, 2023
1 parent 0c43b08 commit dc7e075
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/lib/account_statuses_filter.rb
Expand Up @@ -60,8 +60,12 @@ def filtered_reblogs_scope
.where(reblog_of_id: nil)
.or(
scope
# This is basically `Status.not_domain_blocked_by_account(current_account)`
# and `Status.not_excluded_by_account(current_account)` but on the
# `reblog` association. Unfortunately, there seem to be no clean way
# to re-use those scopes in our case.
.where(reblog: { accounts: { domain: nil } }).or(scope.where.not(reblog: { accounts: { domain: current_account.excluded_from_timeline_domains } }))
.where.not(reblog: { account_id: current_account.excluded_from_timeline_account_ids })
.where.not(reblog: { accounts: { domain: current_account.excluded_from_timeline_domains } })
)
end

Expand Down
Expand Up @@ -202,7 +202,7 @@ def status_with_media_attachment!(visibility)
context 'when blocking a reblogged domain' do
let(:other_account) { Fabricate(:account, domain: 'example.com') }
let(:reblogging_status) { Fabricate(:status, account: other_account) }
let(:reblog) { Fabricate(:status, account: account, visibility: 'public', reblog: reblogging_status) }
let!(:reblog) { Fabricate(:status, account: account, visibility: 'public', reblog: reblogging_status) }

before do
current_account.block_domain!(other_account.domain)
Expand All @@ -213,6 +213,20 @@ def status_with_media_attachment!(visibility)
end
end

context 'when blocking an unrelated domain' do
let(:other_account) { Fabricate(:account, domain: nil) }
let(:reblogging_status) { Fabricate(:status, account: other_account, visibility: 'public') }
let!(:reblog) { Fabricate(:status, account: account, visibility: 'public', reblog: reblogging_status) }

before do
current_account.block_domain!('example.com')
end

it 'returns the reblog from the non-blocked domain' do
expect(subject.results.pluck(:id)).to include(reblog.id)
end
end

context 'when muting a reblogged account' do
let(:reblog) { status_with_reblog!('public') }

Expand Down

0 comments on commit dc7e075

Please sign in to comment.