gab-social/app/services/fan_out_on_write_service.rb

25 lines
564 B
Ruby
Raw Normal View History

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?
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