1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2025-03-24 05:39:44 +01:00

If you mention group actor, also mention group actor followers

This commit is contained in:
noellabo 2019-10-04 03:16:19 +09:00
parent 7fdff65f31
commit 5a1582c2a2
No known key found for this signature in database
GPG key ID: 83C44358FCC835E1

View file

@ -68,10 +68,19 @@ class ActivityPub::TagManager
if status.account.silenced?
# Only notify followers if the account is locally silenced
account_ids = status.active_mentions.pluck(:account_id)
to = status.account.followers.where(id: account_ids).map { |account| uri_for(account) }
to.concat(FollowRequest.where(target_account_id: status.account_id, account_id: account_ids).map { |request| uri_for(request.account) })
to = status.account.followers.where(id: account_ids).each_with_object([]) do |account, result|
result << uri_for(account)
result << account.followers_url if account.group?
end
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 << request.account.followers_url if request.account.group?
end)
else
status.active_mentions.map { |mention| uri_for(mention.account) }
status.active_mentions.each_with_object([]) do |mention, result|
result << uri_for(mention.account)
result << mention.account.followers_url if mention.account.group?
end
end
end
end
@ -97,10 +106,19 @@ class ActivityPub::TagManager
if status.account.silenced?
# Only notify followers if the account is locally silenced
account_ids = status.active_mentions.pluck(:account_id)
cc.concat(status.account.followers.where(id: account_ids).map { |account| uri_for(account) })
cc.concat(FollowRequest.where(target_account_id: status.account_id, account_id: account_ids).map { |request| uri_for(request.account) })
cc.concat(status.account.followers.where(id: account_ids).each_with_object([]) do |account, result|
result << uri_for(account)
result << account.followers_url if account.group?
end)
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 << request.account.followers_url if request.account.group?
end)
else
cc.concat(status.active_mentions.map { |mention| uri_for(mention.account) })
cc.concat(status.active_mentions.each_with_object([]) do |mention, result|
result << uri_for(mention.account)
result << mention.account.followers_url if mention.account.group?
end)
end
end