Use FanOutOnWriteService AFTER processing mentions

This commit is contained in:
Eugen Rochko 2016-03-19 00:41:29 +01:00
parent 47d1cb4e21
commit f97fc9744f
4 changed files with 17 additions and 1 deletions

View file

@ -78,6 +78,5 @@ class Status < ActiveRecord::Base
after_create do after_create do
self.account.stream_entries.create!(activity: self) self.account.stream_entries.create!(activity: self)
FanOutOnWriteService.new.(self)
end end
end end

View file

@ -7,6 +7,7 @@ class PostStatusService < BaseService
def call(account, text, in_reply_to = nil) def call(account, text, in_reply_to = nil)
status = account.statuses.create!(text: text, thread: in_reply_to) status = account.statuses.create!(text: text, thread: in_reply_to)
process_mentions_service.(status) process_mentions_service.(status)
fan_out_on_write_service.(status)
account.ping!(account_url(account, format: 'atom'), [Rails.configuration.x.hub_url]) account.ping!(account_url(account, format: 'atom'), [Rails.configuration.x.hub_url])
status status
end end
@ -16,4 +17,8 @@ class PostStatusService < BaseService
def process_mentions_service def process_mentions_service
@process_mentions_service ||= ProcessMentionsService.new @process_mentions_service ||= ProcessMentionsService.new
end end
def fan_out_on_write_service
@fan_out_on_write_service ||= FanOutOnWriteService.new
end
end end

View file

@ -52,6 +52,9 @@ class ProcessFeedService < BaseService
end end
end end
end end
fan_out_on_write_service.(status)
end end
end end
end end
@ -166,4 +169,8 @@ class ProcessFeedService < BaseService
def update_remote_profile_service def update_remote_profile_service
@update_remote_profile_service ||= UpdateRemoteProfileService.new @update_remote_profile_service ||= UpdateRemoteProfileService.new
end end
def fan_out_on_write_service
@fan_out_on_write_service ||= FanOutOnWriteService.new
end
end end

View file

@ -5,6 +5,7 @@ class ReblogService < BaseService
# @return [Status] # @return [Status]
def call(account, reblogged_status) def call(account, reblogged_status)
reblog = account.statuses.create!(reblog: reblogged_status, text: '') 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]) account.ping!(account_url(account, format: 'atom'), [Rails.configuration.x.hub_url])
return reblog if reblogged_status.local? return reblog if reblogged_status.local?
send_interaction_service.(reblog.stream_entry, reblogged_status.account) send_interaction_service.(reblog.stream_entry, reblogged_status.account)
@ -16,4 +17,8 @@ class ReblogService < BaseService
def send_interaction_service def send_interaction_service
@send_interaction_service ||= SendInteractionService.new @send_interaction_service ||= SendInteractionService.new
end end
def fan_out_on_write_service
@fan_out_on_write_service ||= FanOutOnWriteService.new
end
end end