Improve group processing (#14279)

* Fix the local group's followers collection

* Fix to accept followed relayed_through_account

* Add local delivery to the group's followers

* Fix code style

* Revert "Add local delivery to the group's followers"

This reverts commit 3237effc199772e4c4d30f19082cbc5633f56196.
This commit is contained in:
Takeshi Umeda 2020-07-15 02:05:34 +09:00 committed by GitHub
parent 6a96af4d20
commit 5c23ec2fa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -185,7 +185,7 @@ class ActivityPub::Activity
end end
def followed_by_local_accounts? def followed_by_local_accounts?
@account.passive_relationships.exists? @account.passive_relationships.exists? || @options[:relayed_through_account]&.passive_relationships&.exists?
end end
def requested_through_relay? def requested_through_relay?

View File

@ -72,16 +72,16 @@ class ActivityPub::TagManager
account_ids = status.active_mentions.pluck(:account_id) account_ids = status.active_mentions.pluck(:account_id)
to = status.account.followers.where(id: account_ids).each_with_object([]) do |account, result| to = status.account.followers.where(id: account_ids).each_with_object([]) do |account, result|
result << uri_for(account) result << uri_for(account)
result << account.followers_url if account.group? result << account_followers_url(account) if account.group?
end end
to.concat(FollowRequest.where(target_account_id: status.account_id, account_id: account_ids).each_with_object([]) do |request, result| to.concat(FollowRequest.where(target_account_id: status.account_id, account_id: account_ids).each_with_object([]) do |request, result|
result << uri_for(request.account) result << uri_for(request.account)
result << request.account.followers_url if request.account.group? result << account_followers_url(request.account) if request.account.group?
end) end)
else else
status.active_mentions.each_with_object([]) do |mention, result| status.active_mentions.each_with_object([]) do |mention, result|
result << uri_for(mention.account) result << uri_for(mention.account)
result << mention.account.followers_url if mention.account.group? result << account_followers_url(mention.account) if mention.account.group?
end end
end end
end end
@ -110,16 +110,16 @@ class ActivityPub::TagManager
account_ids = status.active_mentions.pluck(:account_id) account_ids = status.active_mentions.pluck(:account_id)
cc.concat(status.account.followers.where(id: account_ids).each_with_object([]) do |account, result| cc.concat(status.account.followers.where(id: account_ids).each_with_object([]) do |account, result|
result << uri_for(account) result << uri_for(account)
result << account.followers_url if account.group? result << account_followers_url(account) if account.group?
end) end)
cc.concat(FollowRequest.where(target_account_id: status.account_id, account_id: account_ids).each_with_object([]) do |request, result| cc.concat(FollowRequest.where(target_account_id: status.account_id, account_id: account_ids).each_with_object([]) do |request, result|
result << uri_for(request.account) result << uri_for(request.account)
result << request.account.followers_url if request.account.group? result << account_followers_url(request.account) if request.account.group?
end) end)
else else
cc.concat(status.active_mentions.each_with_object([]) do |mention, result| cc.concat(status.active_mentions.each_with_object([]) do |mention, result|
result << uri_for(mention.account) result << uri_for(mention.account)
result << mention.account.followers_url if mention.account.group? result << account_followers_url(mention.account) if mention.account.group?
end) end)
end end
end end