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

Change: #68 限定投稿の検索許可を反応者に設定可能に #120

Merged
merged 1 commit into from
Oct 15, 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
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