about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-03-19 00:41:29 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-03-19 00:41:29 +0100
commitf97fc9744f7879246ecc04e3f5ec4f358a9d71a2 (patch)
tree21e1fd4e2ae33fd49e1b76d4d1e6964f1b6284b7 /app
parent47d1cb4e2183949e50488187a74e3ce9b3d7d3b8 (diff)
Use FanOutOnWriteService AFTER processing mentions
Diffstat (limited to 'app')
-rw-r--r--app/models/status.rb1
-rw-r--r--app/services/post_status_service.rb5
-rw-r--r--app/services/process_feed_service.rb7
-rw-r--r--app/services/reblog_service.rb5
4 files changed, 17 insertions, 1 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index 10f0444e9..7c5cd2f8a 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -78,6 +78,5 @@ class Status < ActiveRecord::Base
 
   after_create do
     self.account.stream_entries.create!(activity: self)
-    FanOutOnWriteService.new.(self)
   end
 end
diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb
index 388639175..e8335639c 100644
--- a/app/services/post_status_service.rb
+++ b/app/services/post_status_service.rb
@@ -7,6 +7,7 @@ class PostStatusService < BaseService
   def call(account, text, in_reply_to = nil)
     status = account.statuses.create!(text: text, thread: in_reply_to)
     process_mentions_service.(status)
+    fan_out_on_write_service.(status)
     account.ping!(account_url(account, format: 'atom'), [Rails.configuration.x.hub_url])
     status
   end
@@ -16,4 +17,8 @@ class PostStatusService < BaseService
   def process_mentions_service
     @process_mentions_service ||= ProcessMentionsService.new
   end
+
+  def fan_out_on_write_service
+    @fan_out_on_write_service ||= FanOutOnWriteService.new
+  end
 end
diff --git a/app/services/process_feed_service.rb b/app/services/process_feed_service.rb
index 9b342499d..7f72ea251 100644
--- a/app/services/process_feed_service.rb
+++ b/app/services/process_feed_service.rb
@@ -52,6 +52,9 @@ class ProcessFeedService < BaseService
             end
           end
         end
+
+
+        fan_out_on_write_service.(status)
       end
     end
   end
@@ -166,4 +169,8 @@ class ProcessFeedService < BaseService
   def update_remote_profile_service
     @update_remote_profile_service ||= UpdateRemoteProfileService.new
   end
+
+  def fan_out_on_write_service
+    @fan_out_on_write_service ||= FanOutOnWriteService.new
+  end
 end
diff --git a/app/services/reblog_service.rb b/app/services/reblog_service.rb
index 086f297f4..7078e3aff 100644
--- a/app/services/reblog_service.rb
+++ b/app/services/reblog_service.rb
@@ -5,6 +5,7 @@ class ReblogService < BaseService
   # @return [Status]
   def call(account, reblogged_status)
     reblog = account.statuses.create!(reblog: reblogged_status, text: '')
+    fan_out_on_write_service.(reblog)
     account.ping!(account_url(account, format: 'atom'), [Rails.configuration.x.hub_url])
     return reblog if reblogged_status.local?
     send_interaction_service.(reblog.stream_entry, reblogged_status.account)
@@ -16,4 +17,8 @@ class ReblogService < BaseService
   def send_interaction_service
     @send_interaction_service ||= SendInteractionService.new
   end
+
+  def fan_out_on_write_service
+    @fan_out_on_write_service ||= FanOutOnWriteService.new
+  end
 end