You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
848 B

  1. # frozen_string_literal: true
  2. class ReblogService < BaseService
  3. # Reblog a status and notify its remote author
  4. # @param [Account] account Account to reblog from
  5. # @param [Status] reblogged_status Status to be reblogged
  6. # @return [Status]
  7. def call(account, reblogged_status)
  8. reblog = account.statuses.create!(reblog: reblogged_status, text: '')
  9. DistributionWorker.perform_async(reblog.id)
  10. HubPingWorker.perform_async(account.id)
  11. if reblogged_status.local?
  12. NotificationMailer.reblog(reblogged_status, account).deliver_later unless reblogged_status.account.blocking?(account)
  13. else
  14. NotificationWorker.perform_async(reblog.stream_entry.id, reblogged_status.account_id)
  15. end
  16. reblog
  17. end
  18. private
  19. def send_interaction_service
  20. @send_interaction_service ||= SendInteractionService.new
  21. end
  22. end