The code powering m.abunchtell.com https://m.abunchtell.com
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.
 
 
 
 

22 line
574 B

  1. # frozen_string_literal: true
  2. class FavouriteService < BaseService
  3. # Favourite a status and notify remote user
  4. # @param [Account] account
  5. # @param [Status] status
  6. # @return [Favourite]
  7. def call(account, status)
  8. favourite = Favourite.create!(account: account, status: status)
  9. Pubsubhubbub::DistributionWorker.perform_async(favourite.stream_entry.id)
  10. if status.local?
  11. NotifyService.new.call(status.account, favourite)
  12. else
  13. NotificationWorker.perform_async(favourite.stream_entry.id, status.account_id)
  14. end
  15. favourite
  16. end
  17. end