diff options
author | Thibaut Girka <thib@sitedethib.com> | 2019-05-10 17:09:12 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2019-05-10 17:09:12 +0200 |
commit | 68629f2773a056b0120b956e0cb425e73fe57cab (patch) | |
tree | 94f79c3baeec31b58d36e37515b753b9d2a02ab6 /app/lib/activitypub | |
parent | 3191c3b349f67442f3ae42be6e1b141e2392a293 (diff) | |
parent | 780d99c204df824fe959a3db00999f973a29c351 (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - app/controllers/statuses_controller.rb minor conflict because of glitch-soc's theming system - app/controllers/stream_entries_controller.rb minor conflict because of glitch-soc's theming system
Diffstat (limited to 'app/lib/activitypub')
-rw-r--r-- | app/lib/activitypub/tag_manager.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/app/lib/activitypub/tag_manager.rb b/app/lib/activitypub/tag_manager.rb index 892bb9974..595291342 100644 --- a/app/lib/activitypub/tag_manager.rb +++ b/app/lib/activitypub/tag_manager.rb @@ -65,7 +65,14 @@ class ActivityPub::TagManager when 'unlisted', 'private' [account_followers_url(status.account)] when 'direct', 'limited' - status.active_mentions.map { |mention| uri_for(mention.account) } + 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) }) + else + status.active_mentions.map { |mention| uri_for(mention.account) } + end end end @@ -86,7 +93,16 @@ class ActivityPub::TagManager cc << COLLECTIONS[:public] end - cc.concat(status.active_mentions.map { |mention| uri_for(mention.account) }) unless status.direct_visibility? || status.limited_visibility? + unless status.direct_visibility? || status.limited_visibility? + 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) }) + else + cc.concat(status.active_mentions.map { |mention| uri_for(mention.account) }) + end + end cc end |