#15 Add misskey fork indexable support
This commit is contained in:
parent
385ac0c1a2
commit
2f21aa5193
3 changed files with 50 additions and 1 deletions
|
@ -265,7 +265,7 @@ class ActivityPub::ProcessAccountService < BaseService
|
|||
bio = searchability_from_bio
|
||||
return bio unless bio.nil?
|
||||
|
||||
return misskey_software? ? :public : :direct
|
||||
return misskey_software? ? misskey_searchability_from_indexable : :direct
|
||||
end
|
||||
|
||||
if audience_searchable_by.any? { |uri| ActivityPub::TagManager.instance.public_collection?(uri) }
|
||||
|
@ -297,6 +297,12 @@ class ActivityPub::ProcessAccountService < BaseService
|
|||
searchability
|
||||
end
|
||||
|
||||
def misskey_searchability_from_indexable
|
||||
return :public if @json['indexable'].nil?
|
||||
|
||||
@json['indexable'] ? :public : :limited
|
||||
end
|
||||
|
||||
def instance_info
|
||||
@instance_info ||= InstanceInfo.find_by(domain: @domain)
|
||||
end
|
||||
|
|
|
@ -169,6 +169,14 @@ RSpec.describe Status do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when limited-public' do
|
||||
let(:account_searchability) { :limited }
|
||||
|
||||
it 'returns limited' do
|
||||
expect(subject.compute_searchability).to eq 'limited'
|
||||
end
|
||||
end
|
||||
|
||||
context 'when private-limited' do
|
||||
let(:account_searchability) { :private }
|
||||
let(:status_searchability) { :limited }
|
||||
|
|
|
@ -11,6 +11,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
|||
let(:software) { 'mastodon' }
|
||||
let(:searchable_by) { 'https://www.w3.org/ns/activitystreams#Public' }
|
||||
let(:sender_bio) { '' }
|
||||
let(:indexable) { nil }
|
||||
let(:payload) do
|
||||
{
|
||||
id: 'https://foo.test',
|
||||
|
@ -18,6 +19,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
|||
inbox: 'https://foo.test/inbox',
|
||||
followers: 'https://example.com/followers',
|
||||
searchableBy: searchable_by,
|
||||
indexable: indexable,
|
||||
summary: sender_bio,
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
@ -73,6 +75,39 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
|||
it 'searchability is public' do
|
||||
expect(subject.searchability).to eq 'public'
|
||||
end
|
||||
|
||||
context 'with true indexable' do
|
||||
let(:indexable) { true }
|
||||
|
||||
it 'searchability is public' do
|
||||
expect(subject.searchability).to eq 'public'
|
||||
end
|
||||
end
|
||||
|
||||
context 'with false indexable' do
|
||||
let(:indexable) { false }
|
||||
|
||||
it 'searchability is limited' do
|
||||
expect(subject.searchability).to eq 'limited'
|
||||
end
|
||||
end
|
||||
|
||||
context 'with no-indexable key' do
|
||||
let(:payload) do
|
||||
{
|
||||
id: 'https://foo.test',
|
||||
type: 'Actor',
|
||||
inbox: 'https://foo.test/inbox',
|
||||
followers: 'https://example.com/followers',
|
||||
searchableBy: searchable_by,
|
||||
summary: sender_bio,
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
it 'searchability is public' do
|
||||
expect(subject.searchability).to eq 'public'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with bio' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue