diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-11-06 15:56:34 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-11-06 15:56:34 +0100 |
commit | 93212bc2c45eb06bdb1eb1f05a69701001a2a1fb (patch) | |
tree | c489b7ebabe964cfba85c00e083d0f70fb95c760 /app | |
parent | 7bb28bf7804eadbaeac05e7adb8123a8fb6c5d02 (diff) |
Add test for FanOutOnWriteService
Diffstat (limited to 'app')
-rw-r--r-- | app/services/fan_out_on_write_service.rb | 10 | ||||
-rw-r--r-- | app/services/fetch_remote_status_service.rb | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index a36f80150..674665592 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -15,10 +15,13 @@ class FanOutOnWriteService < BaseService private def deliver_to_self(status) + Rails.logger.debug "Delivering status #{status.id} to author" FeedManager.instance.push(:home, status.account, status) end def deliver_to_followers(status) + Rails.logger.debug "Delivering status #{status.id} to followers" + status.account.followers.find_each do |follower| next if !follower.local? || FeedManager.instance.filter?(:home, status, follower) FeedManager.instance.push(:home, follower, status) @@ -26,7 +29,9 @@ class FanOutOnWriteService < BaseService end def deliver_to_mentioned(status) - status.mentions.find_each do |mention| + Rails.logger.debug "Delivering status #{status.id} to mentioned accounts" + + status.mentions.includes(:account).each do |mention| mentioned_account = mention.account next if !mentioned_account.local? || mentioned_account.id == status.account_id || FeedManager.instance.filter?(:mentions, status, mentioned_account) FeedManager.instance.push(:mentions, mentioned_account, status) @@ -34,12 +39,15 @@ class FanOutOnWriteService < BaseService end def deliver_to_hashtags(status) + Rails.logger.debug "Delivering status #{status.id} to hashtags" + status.tags.find_each do |tag| FeedManager.instance.broadcast("hashtag:#{tag.name}", id: status.id) end end def deliver_to_public(status) + Rails.logger.debug "Delivering status #{status.id} to public timeline" FeedManager.instance.broadcast(:public, id: status.id) end end diff --git a/app/services/fetch_remote_status_service.rb b/app/services/fetch_remote_status_service.rb index fbf7e3bd6..54ac3006e 100644 --- a/app/services/fetch_remote_status_service.rb +++ b/app/services/fetch_remote_status_service.rb @@ -9,7 +9,7 @@ class FetchRemoteStatusService < BaseService private def process_atom(url, body) - Rails.logger.debug 'Processing Atom for remote status' + Rails.logger.debug "Processing Atom for remote status at #{url}" xml = Nokogiri::XML(body) account = extract_author(url, xml) |