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
590 B

  1. class FavouriteService < BaseService
  2. # Favourite a status and notify remote user
  3. # @param [Account] account
  4. # @param [Status] status
  5. # @return [Favourite]
  6. def call(account, status)
  7. favourite = Favourite.create!(account: account, status: status)
  8. account.ping!(account_url(account, format: 'atom'), [Rails.configuration.x.hub_url])
  9. return favourite if status.local?
  10. send_interaction_service.(favourite.stream_entry, status.account)
  11. favourite
  12. end
  13. private
  14. def send_interaction_service
  15. @send_interaction_service ||= SendInteractionService.new
  16. end
  17. end