diff options
Diffstat (limited to 'app/services/fan_out_on_write_service.rb')
-rw-r--r-- | app/services/fan_out_on_write_service.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index 71f6cbca1..402b84b2f 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -5,7 +5,12 @@ class FanOutOnWriteService < BaseService # @param [Status] status def call(status) deliver_to_self(status) if status.account.local? - deliver_to_followers(status) + + if status.direct_visibility? + deliver_to_mentioned_followers(status) + else + deliver_to_followers(status) + end return if status.account.silenced? || !status.public_visibility? || status.reblog? @@ -32,6 +37,16 @@ class FanOutOnWriteService < BaseService end end + def deliver_to_mentioned_followers(status) + Rails.logger.debug "Delivering status #{status.id} to mentioned followers" + + status.mentions.includes(:account).each do |mention| + mentioned_account = mention.account + next if !mentioned_account.local? || !mentioned_account.following?(status.account) || FeedManager.instance.filter?(:home, status, mentioned_account) + FeedManager.instance.push(:home, mentioned_account, status) + end + end + def deliver_to_hashtags(status) Rails.logger.debug "Delivering status #{status.id} to hashtags" |