Add limited-searchability activitypub support
This commit is contained in:
parent
c4e8af4417
commit
0907b67239
2 changed files with 12 additions and 6 deletions
|
@ -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
|
||||
|
@ -503,16 +505,16 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
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 = :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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue