Add limited-searchability activitypub support

This commit is contained in:
KMY 2023-05-24 14:44:46 +09:00
parent c4e8af4417
commit 0907b67239
2 changed files with 12 additions and 6 deletions

View file

@ -480,6 +480,8 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
nil
elsif audience_searchable_by.any? { |uri| ActivityPub::TagManager.instance.public_collection?(uri) }
:public
elsif audience_searchable_by.include?('as:Limited')
:limited
elsif audience_searchable_by.include?(@account.followers_url)
:private
else
@ -502,17 +504,17 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
searchability = searchability_bio[0]
return nil if searchability.nil?
searchability = :public if searchability == 'public'
searchability = :unlisted if searchability == 'followers'
searchability = :direct if searchability == 'private'
searchability = :private if searchability == 'reactors'
searchability = :public if searchability == 'public'
searchability = :private if searchability == 'followers'
searchability = :limited if searchability == 'private'
searchability = :direct if searchability == 'reactors'
end
visibility = visibility_from_audience_with_silence
if searchability == visibility
if searchability == visibility || searchability == :limited || searchability == :direct
searchability
elsif [:public, :unlisted, :private].include?(searchability) && [:public, :unlisted, :private].include?(visibility)
elsif [:public, :unlisted, :private].include?(searchability) && [:public, :public_unlisted, :unlisted, :private].include?(visibility)
:private
else
:direct

View file

@ -217,6 +217,8 @@ class ActivityPub::TagManager
[account_followers_url(status.account)]
when 'direct'
status.conversation_id.present? ? [uri_for(status.conversation)] : []
when 'limited'
['as:Limited']
else
[]
end
@ -230,6 +232,8 @@ class ActivityPub::TagManager
[COLLECTIONS[:public]]
when 'private', 'direct'
[account_followers_url(account)]
when 'limited'
['as:Limited']
else
[]
end