Skip to content

Commit

Permalink
Fix: #78 検索許可のas:Limitedkmyblue:Limitedに変更
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode committed Oct 10, 2023
1 parent e2c7a6e commit e61350c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/lib/activitypub/activity/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def searchability_from_audience
nil
elsif audience_searchable_by.any? { |uri| ActivityPub::TagManager.instance.public_collection?(uri) }
:public
elsif audience_searchable_by.include?('as:Limited')
elsif audience_searchable_by.include?('kmyblue:Limited') || audience_searchable_by.include?('as:Limited')
:limited
elsif audience_searchable_by.include?(@account.followers_url)
:private
Expand Down
4 changes: 2 additions & 2 deletions app/lib/activitypub/tag_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def searchable_by(status)
when 'direct'
status.conversation_id.present? ? [uri_for(status.conversation)] : []
when 'limited'
['as:Limited']
['as:Limited', 'kmyblue:Limited']
else
[]
end
Expand All @@ -258,7 +258,7 @@ def account_searchable_by(account)
when 'private', 'direct'
[account_followers_url(account)]
when 'limited'
['as:Limited']
['as:Limited', 'kmyblue:Limited']
else
[]
end
Expand Down
2 changes: 1 addition & 1 deletion app/services/activitypub/process_account_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def searchability_from_audience
:public
elsif audience_searchable_by.include?(@account.followers_url)
:private
elsif audience_searchable_by.include?('as:Limited')
elsif audience_searchable_by.include?('kmyblue:Limited') || audience_searchable_by.include?('as:Limited')
:limited
else
:direct
Expand Down
13 changes: 12 additions & 1 deletion spec/lib/activitypub/activity/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,17 @@
end

context 'with limited' do
let(:searchable_by) { 'kmyblue:Limited' }

it 'create status' do
status = sender.statuses.first

expect(status).to_not be_nil
expect(status.searchability).to eq 'limited'
end
end

context 'with limited old spec' do
let(:searchable_by) { 'as:Limited' }

it 'create status' do
Expand Down Expand Up @@ -570,7 +581,7 @@

context 'with misskey' do
let(:sender_software) { 'misskey' }
let(:searchable_by) { 'as:Limited' }
let(:searchable_by) { 'kmyblue:Limited' }

it 'create status' do
status = sender.statuses.first
Expand Down
8 changes: 8 additions & 0 deletions spec/services/activitypub/process_account_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@
end

context 'when limited' do
let(:searchable_by) { 'kmyblue:Limited' }

it 'searchability is limited' do
expect(subject.searchability).to eq 'limited'
end
end

context 'when limited old spec' do
let(:searchable_by) { 'as:Limited' }

it 'searchability is limited' do
Expand Down

0 comments on commit e61350c

Please sign in to comment.