Fix: ドメインブロックがOutboxにおいて動作しない問題 (LTS)
This commit is contained in:
parent
49d561178d
commit
eb280d93a9
2 changed files with 37 additions and 3 deletions
|
@ -33,7 +33,8 @@ class AccountStatusesFilter
|
|||
available_visibilities -= [:unlisted] if (domain_block&.detect_invalid_subscription || misskey_software?) && @account.user&.setting_reject_unlisted_subscription
|
||||
available_visibilities -= [:login] if current_account.nil?
|
||||
|
||||
scope.merge!(scope.where(spoiler_text: ['', nil])) if domain_block&.reject_send_sensitive
|
||||
scope.merge!(scope.where(sensitive: false)) if domain_block&.reject_send_sensitive
|
||||
|
||||
scope.merge!(scope.where(searchability: available_searchabilities))
|
||||
scope.merge!(scope.where(visibility: available_visibilities))
|
||||
|
||||
|
@ -155,9 +156,9 @@ class AccountStatusesFilter
|
|||
end
|
||||
|
||||
def domain_block
|
||||
return nil if @account.nil? || @account.local?
|
||||
return nil if @current_account.nil? || @current_account.local?
|
||||
|
||||
@domain_block = DomainBlock.find_by(domain: @account.domain)
|
||||
@domain_block = DomainBlock.find_by(domain: @current_account.domain)
|
||||
end
|
||||
|
||||
def misskey_software?
|
||||
|
|
|
@ -282,5 +282,38 @@ RSpec.describe AccountStatusesFilter do
|
|||
|
||||
it_behaves_like 'filter params'
|
||||
end
|
||||
|
||||
context 'when accessed by remote user' do
|
||||
let(:current_account) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/actor') }
|
||||
let(:sensitive_status_with_cw) { Fabricate(:status, sensitive: true, spoiler_text: 'CW', account: account) }
|
||||
let(:sensitive_status_with_media) do
|
||||
Fabricate(:status, sensitive: true, spoiler_text: 'CW', account: account).tap do |status|
|
||||
Fabricate(:media_attachment, account: account, status: status)
|
||||
end
|
||||
end
|
||||
|
||||
before do
|
||||
Fabricate(:domain_block, domain: 'example.com', severity: :noop, reject_send_sensitive: true)
|
||||
end
|
||||
|
||||
it 'returns everything' do
|
||||
expect(subject.results.pluck(:visibility).uniq).to match_array %w(login unlisted public_unlisted public)
|
||||
end
|
||||
|
||||
it 'returns replies' do
|
||||
expect(subject.results.pluck(:in_reply_to_id)).to_not be_empty
|
||||
end
|
||||
|
||||
it 'returns reblogs' do
|
||||
expect(subject.results.pluck(:reblog_of_id)).to_not be_empty
|
||||
end
|
||||
|
||||
it 'does not send sensitive posts' do
|
||||
expect(subject.results.pluck(:id)).to_not include sensitive_status_with_cw.id
|
||||
expect(subject.results.pluck(:id)).to_not include sensitive_status_with_media.id
|
||||
end
|
||||
|
||||
it_behaves_like 'filter params'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue