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.

19 lines
648 B

  1. class ReblogService < BaseService
  2. # Reblog a status and notify its remote author
  3. # @param [Account] account Account to reblog from
  4. # @param [Status] reblogged_status Status to be reblogged
  5. # @return [Status]
  6. def call(account, reblogged_status)
  7. reblog = account.statuses.create!(reblog: reblogged_status, text: '')
  8. account.ping!(account_url(account, format: 'atom'), [HUB_URL])
  9. return reblog if reblogged_status.local?
  10. send_interaction_service.(reblog.stream_entry, reblogged_status.account)
  11. reblog
  12. end
  13. private
  14. def send_interaction_service
  15. @send_interaction_service ||= SendInteractionService.new
  16. end
  17. end