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.

15 lines
555 B

  1. # frozen_string_literal: true
  2. class BlockService < BaseService
  3. def call(account, target_account)
  4. return if account.id == target_account.id
  5. UnfollowService.new.call(account, target_account) if account.following?(target_account)
  6. UnfollowService.new.call(target_account, account) if target_account.following?(account)
  7. block = account.block!(target_account)
  8. BlockWorker.perform_async(account.id, target_account.id)
  9. NotificationWorker.perform_async(block.stream_entry.id, target_account.id) unless target_account.local?
  10. end
  11. end