2019-07-02 08:10:25 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class FanOutOnWriteService < BaseService
|
2020-07-02 02:40:00 +01:00
|
|
|
|
2019-07-02 08:10:25 +01:00
|
|
|
# Push a status into home and mentions feeds
|
|
|
|
# @param [Status] status
|
2020-11-15 18:48:32 +00:00
|
|
|
def call(status)
|
2019-07-02 08:10:25 +01:00
|
|
|
raise GabSocial::RaceConditionError if status.visibility.nil?
|
2020-12-16 00:31:30 +00:00
|
|
|
deliver_to_self(status) if status.account.local?
|
2019-07-02 08:10:25 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def deliver_to_self(status)
|
|
|
|
Rails.logger.debug "Delivering status #{status.id} to author"
|
|
|
|
FeedManager.instance.push_to_home(status.account, status)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|