]> cat aescling's git repositories - mastodon.git/commitdiff
Use FanOutOnWriteService AFTER processing mentions
authorEugen Rochko <eugen@zeonfederated.com>
Fri, 18 Mar 2016 23:41:29 +0000 (00:41 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Fri, 18 Mar 2016 23:41:29 +0000 (00:41 +0100)
app/models/status.rb
app/services/post_status_service.rb
app/services/process_feed_service.rb
app/services/reblog_service.rb

index 10f0444e9d4aad3b7b801056d8fb5ca1412c5ae2..7c5cd2f8aea3f78f7041a7eb90d16eda303674d1 100644 (file)
@@ -78,6 +78,5 @@ class Status < ActiveRecord::Base
 
   after_create do
     self.account.stream_entries.create!(activity: self)
-    FanOutOnWriteService.new.(self)
   end
 end
index 38863917572cd5f2a8899ec7af286a0b382adcd7..e8335639c3ec3f71bae3f40e1f89e6a3ab01a399 100644 (file)
@@ -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
index 9b342499d3b927776e2e2e16813cb26fa43b88c6..7f72ea251d95c92bf9f59d8b02f82088cc4a17be 100644 (file)
@@ -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
index 086f297f4f1e2a3cd563c06959171a7b13718c6d..7078e3aff25a40414e3faad3722e7f510b170395 100644 (file)
@@ -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