Skip to content

Commit

Permalink
Change: #68 限定投稿の検索許可を反応者に設定可能に (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode authored Oct 15, 2023
1 parent a772f72 commit d0f0dd7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/models/status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions spec/services/post_status_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand Down

0 comments on commit d0f0dd7

Please sign in to comment.