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

Fix: #83 フレンドサーバーでの全投稿配送で、アカウントドメインブロックが無視される問題 #102

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/lib/status_reach_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ def relay_inboxes

def friend_inboxes
if @status.public_visibility? || @status.public_unlisted_visibility? || (@status.unlisted_visibility? && (@status.public_searchability? || @status.public_unlisted_searchability?))
DeliveryFailureTracker.without_unavailable(FriendDomain.distributables.where(delivery_local: true).pluck(:inbox_url))
DeliveryFailureTracker.without_unavailable(FriendDomain.distributables.where(delivery_local: true).where.not(domain: AccountDomainBlock.where(account: @status.account).select(:domain)).pluck(:inbox_url))
else
[]
end
end

def nolocal_friend_inboxes
if @status.public_visibility?
DeliveryFailureTracker.without_unavailable(FriendDomain.distributables.where(delivery_local: false).pluck(:inbox_url))
DeliveryFailureTracker.without_unavailable(FriendDomain.distributables.where(delivery_local: false).where.not(domain: AccountDomainBlock.where(account: @status.account).select(:domain)).pluck(:inbox_url))
else
[]
end
Expand Down
12 changes: 12 additions & 0 deletions spec/lib/status_reach_finder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,18 @@
expect(subject.inboxes_for_friend).to_not include 'https://foo.bar/inbox'
end
end

context 'when distributable but domain blocked by account' do
before do
Fabricate(:account_domain_block, account: alice, domain: 'foo.bar')
Fabricate(:friend_domain, domain: 'foo.bar', inbox_url: 'https://foo.bar/inbox', passive_state: :accepted, pseudo_relay: true)
end

it 'send status' do
expect(subject.inboxes).to_not include 'https://foo.bar/inbox'
expect(subject.inboxes_for_friend).to_not include 'https://foo.bar/inbox'
end
end
end

context 'when it contains distributable friend server' do
Expand Down