diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-08-26 12:17:10 -0500 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-08-26 12:17:10 -0500 |
commit | 90ffbb0ada5c81451742e66635bc54eb0f7716f2 (patch) | |
tree | 7af8acbc29ea1750a58fb7cc78782bb97bf73a84 /app/lib/activitypub | |
parent | 35636272c0164372954b52a8a957ba08d645330d (diff) |
don't drop posts with invisible participants if they explicitly mention a local user
Diffstat (limited to 'app/lib/activitypub')
-rw-r--r-- | app/lib/activitypub/activity/create.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index 3c0883180..b9c6d1c45 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -53,6 +53,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity @mentions = [] @params = {} @potential_scope_leak = false + @mentions_local_account = false process_status_params return reject_payload! if twitter_retweet? || recipient_rejects_replies? @@ -146,16 +147,19 @@ class ActivityPub::Activity::Create < ActivityPub::Activity account = account_from_uri(audience) if account.nil? - if !rejecting_unknown? || @options[:requested] - @potential_scope_leak = true unless Account.where(followers_url: audience, suspended_at: nil).exists? - else - @potential_scope_leak = true unless Account.where(followers_url: audience, known: true, suspended_at: nil).exists? + unless @mentions_local_account + if !rejecting_unknown? || @options[:requested] + @potential_scope_leak = true unless Account.where(followers_url: audience, suspended_at: nil).exists? + else + @potential_scope_leak = true unless Account.where(followers_url: audience, known: true, suspended_at: nil).exists? + end end next end next if @mentions.any? { |mention| mention.account_id == account.id } + @mentions_local_account = true if account.local? @mentions << Mention.new(account: account, silent: true) # If there is at least one silent mention, then the status can be considered @@ -217,7 +221,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity end def potential_scope_leak? - @potential_scope_leak && @mentions.blank? + @potential_scope_leak && !@mentions_local_account end def process_hashtag(tag) @@ -250,6 +254,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity return end + @mentions_local_account = true if account.local? @mentions << Mention.new(account: account, silent: false) end |