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.

18 lines
563 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. if status.local?
  10. NotificationMailer.favourite(status, account).deliver_later
  11. else
  12. NotificationWorker.perform_async(favourite.stream_entry.id, status.account_id)
  13. end
  14. favourite
  15. end
  16. end