The code powering m.abunchtell.com https://m.abunchtell.com
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

reblog_service.rb 893 B

123456789101112131415161718192021222324252627282930
  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. raise Mastodon::NotPermitted if reblogged_status.private_visibility?
  9. reblog = account.statuses.create!(reblog: reblogged_status, text: '')
  10. DistributionWorker.perform_async(reblog.id)
  11. Pubsubhubbub::DistributionWorker.perform_async(reblog.stream_entry.id)
  12. if reblogged_status.local?
  13. NotifyService.new.call(reblogged_status.account, reblog)
  14. else
  15. NotificationWorker.perform_async(reblog.stream_entry.id, reblogged_status.account_id)
  16. end
  17. reblog
  18. end
  19. private
  20. def send_interaction_service
  21. @send_interaction_service ||= SendInteractionService.new
  22. end
  23. end