|
|
|
@ -65,11 +65,11 @@ class ActivityPub::Activity::Create < ActivityPub::Activity |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def audience_to |
|
|
|
|
@object['to'] || @json['to'] |
|
|
|
|
as_array(@object['to'] || @json['to']).map { |x| value_or_id(x) } |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def audience_cc |
|
|
|
|
@object['cc'] || @json['cc'] |
|
|
|
|
as_array(@object['cc'] || @json['cc']).map { |x| value_or_id(x) } |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def process_status |
|
|
|
@ -122,7 +122,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def process_audience |
|
|
|
|
(as_array(audience_to) + as_array(audience_cc)).uniq.each do |audience| |
|
|
|
|
(audience_to + audience_cc).uniq.each do |audience| |
|
|
|
|
next if audience == ActivityPub::TagManager::COLLECTIONS[:public] |
|
|
|
|
|
|
|
|
|
# Unlike with tags, there is no point in resolving accounts we don't already |
|
|
|
@ -352,11 +352,11 @@ class ActivityPub::Activity::Create < ActivityPub::Activity |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def visibility_from_audience |
|
|
|
|
if equals_or_includes?(audience_to, ActivityPub::TagManager::COLLECTIONS[:public]) |
|
|
|
|
if audience_to.include?(ActivityPub::TagManager::COLLECTIONS[:public]) |
|
|
|
|
:public |
|
|
|
|
elsif equals_or_includes?(audience_cc, ActivityPub::TagManager::COLLECTIONS[:public]) |
|
|
|
|
elsif audience_cc.include?(ActivityPub::TagManager::COLLECTIONS[:public]) |
|
|
|
|
:unlisted |
|
|
|
|
elsif equals_or_includes?(audience_to, @account.followers_url) |
|
|
|
|
elsif audience_to.include?(@account.followers_url) |
|
|
|
|
:private |
|
|
|
|
else |
|
|
|
|
:direct |
|
|
|
@ -365,7 +365,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity |
|
|
|
|
|
|
|
|
|
def audience_includes?(account) |
|
|
|
|
uri = ActivityPub::TagManager.instance.uri_for(account) |
|
|
|
|
equals_or_includes?(audience_to, uri) || equals_or_includes?(audience_cc, uri) |
|
|
|
|
audience_to.include?(uri) || audience_cc.include?(uri) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def replied_to_status |
|
|
|
@ -477,7 +477,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity |
|
|
|
|
def addresses_local_accounts? |
|
|
|
|
return true if @options[:delivered_to_account_id] |
|
|
|
|
|
|
|
|
|
local_usernames = (as_array(audience_to) + as_array(audience_cc)).uniq.select { |uri| ActivityPub::TagManager.instance.local_uri?(uri) }.map { |uri| ActivityPub::TagManager.instance.uri_to_local_id(uri, :username) } |
|
|
|
|
local_usernames = (audience_to + audience_cc).uniq.select { |uri| ActivityPub::TagManager.instance.local_uri?(uri) }.map { |uri| ActivityPub::TagManager.instance.uri_to_local_id(uri, :username) } |
|
|
|
|
|
|
|
|
|
return false if local_usernames.empty? |
|
|
|
|
|
|
|
|
|