From 9b2130512e50c53a14ebad609e0a66982064762d Mon Sep 17 00:00:00 2001 From: KMY Date: Sun, 15 Oct 2023 13:59:49 +0900 Subject: [PATCH] =?UTF-8?q?Change:=20#68=20=E9=99=90=E5=AE=9A=E6=8A=95?= =?UTF-8?q?=E7=A8=BF=E3=81=AE=E6=A4=9C=E7=B4=A2=E8=A8=B1=E5=8F=AF=E3=82=92?= =?UTF-8?q?=E5=8F=8D=E5=BF=9C=E8=80=85=E3=81=AB=E8=A8=AD=E5=AE=9A=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/status.rb | 6 ++---- spec/services/post_status_service_spec.rb | 11 +++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/models/status.rb b/app/models/status.rb index 4b718cdc928ef5..95d4f2b7595cc5 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -631,12 +631,10 @@ def set_searchability self.searchability = if %w(public public_unlisted login unlisted).include?(visibility) searchability - elsif visibility == 'limited' - :limited + elsif visibility == 'limited' || visibility == 'direct' + searchability == 'limited' ? :limited : :direct elsif visibility == 'private' searchability == 'public' || searchability == 'public_unlisted' ? :private : searchability - elsif visibility == 'direct' - searchability == 'limited' ? :limited : :direct else :direct end diff --git a/spec/services/post_status_service_spec.rb b/spec/services/post_status_service_spec.rb index 529ab09969bdd9..f63829f23495e1 100644 --- a/spec/services/post_status_service_spec.rb +++ b/spec/services/post_status_service_spec.rb @@ -209,6 +209,17 @@ expect(status.mentioned_accounts.first.id).to eq mutual_account.id end + it 'limited visibility and direct searchability' do + account = Fabricate(:account) + text = 'This is an English text.' + + status = subject.call(account, text: text, visibility: 'mutual', searchability: 'public') + + expect(status.visibility).to eq 'limited' + expect(status.limited_scope).to eq 'personal' + expect(status.searchability).to eq 'direct' + end + it 'personal visibility with mutual' do account = Fabricate(:account) text = 'This is an English text.'