diff --git a/app/models/status.rb b/app/models/status.rb index 9f0299a5110272..719ba3eedacced 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -426,6 +426,7 @@ def requires_review_notification? def compute_searchability local = account.local? + return 'private' if public_searchability? && account.silenced? return 'direct' if unsupported_searchability? return searchability if local && !searchability.nil? return 'direct' if local || [:public, :private, :direct, :limited].exclude?(account.searchability.to_sym) diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb index 16210592f4ee74..89f90fc751d26a 100644 --- a/spec/models/status_spec.rb +++ b/spec/models/status_spec.rb @@ -120,7 +120,8 @@ let(:account_searchability) { :public } let(:status_searchability) { :public } let(:account_domain) { 'example.com' } - let(:account) { Fabricate(:account, domain: account_domain, searchability: account_searchability) } + let(:silenced_at) { nil } + let(:account) { Fabricate(:account, domain: account_domain, searchability: account_searchability, silenced_at: silenced_at) } context 'when public-public' do it 'returns public' do @@ -128,6 +129,14 @@ end end + context 'when public-public but silenced' do + let(:silenced_at) { Time.now.utc } + + it 'returns private' do + expect(subject.compute_searchability).to eq 'private' + end + end + context 'when public-private' do let(:status_searchability) { :private }