闭社主体 forked from https://github.com/tootsuite/mastodon
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
559 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. HubPingWorker.perform_async(account.id)
  9. if status.local?
  10. NotificationMailer.favourite(status, account).deliver_later unless status.account.blocking?(account)
  11. else
  12. NotificationWorker.perform_async(favourite.stream_entry.id, status.account_id)
  13. end
  14. favourite
  15. end
  16. end