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-11-15 19:02:45 +00:00
|
|
|
if status.direct_visibility? || status.limited_visibility?
|
|
|
|
#
|
2019-07-02 08:10:25 +01:00
|
|
|
else
|
|
|
|
deliver_to_self(status) if status.account.local?
|
2020-07-02 02:40:00 +01:00
|
|
|
end
|
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
|