From cfe8a3218addfd7e0cc82c6f0054572f3d8aa296 Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Wed, 18 Nov 2020 21:03:32 -0600 Subject: Break up AP envelope addressing by domain --- app/lib/activitypub/tag_manager.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'app/lib/activitypub/tag_manager.rb') diff --git a/app/lib/activitypub/tag_manager.rb b/app/lib/activitypub/tag_manager.rb index fb1c9d7b2..383f182d2 100644 --- a/app/lib/activitypub/tag_manager.rb +++ b/app/lib/activitypub/tag_manager.rb @@ -64,8 +64,8 @@ class ActivityPub::TagManager # Public statuses go out to primarily the public collection # Unlisted and private statuses go out primarily to the followers collection # Others go out only to the people they mention - def to(status, target_domain: nil) - visibility = status.visibility_for_domain(target_domain) + def to(status, domain) + visibility = status.visibility_for_domain(domain) case visibility when 'public', 'unlisted' [status.tags.present? ? COLLECTIONS[:public] : account_followers_url(status.account)] @@ -74,7 +74,7 @@ class ActivityPub::TagManager account_ids |= status.account.follower_ids if visibility == 'private' accounts = status.account.silenced? ? status.account.followers.where(id: account_ids) : Account.where(id: account_ids) - accounts = accounts.where(domain: target_domain) if target_domain.present? + accounts = accounts.where(domain: domain) if domain.present? accounts.each_with_object([]) do |account, result| result << uri_for(account) @@ -88,11 +88,11 @@ class ActivityPub::TagManager # Unlisted statuses go to the public as well # Both of those and private statuses also go to the people mentioned in them # Direct ones don't have a secondary audience - def cc(status, target_domain: nil) + def cc(status, domain) cc = [] cc << uri_for(status.reblog.account) if status.reblog? - visibility = status.visibility_for_domain(target_domain) + visibility = status.visibility_for_domain(domain) case visibility when 'public', 'unlisted' @@ -108,7 +108,7 @@ class ActivityPub::TagManager if account_ids.present? accounts = status.account.silenced? ? status.account.followers.where(id: account_ids) : Account.where(id: account_ids) - accounts = accounts.where(domain: target_domain) if target_domain.present? + accounts = accounts.where(domain: domain) if domain.present? cc.concat(accounts.each_with_object([]) do |account, result| result << uri_for(account) -- cgit