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.
 
 
 
 

24 lines
618 B

  1. # frozen_string_literal: true
  2. class UnblockService < BaseService
  3. include Payloadable
  4. def call(account, target_account)
  5. return unless account.blocking?(target_account)
  6. unblock = account.unblock!(target_account)
  7. create_notification(unblock) if !target_account.local? && target_account.activitypub?
  8. unblock
  9. end
  10. private
  11. def create_notification(unblock)
  12. ActivityPub::DeliveryWorker.perform_async(build_json(unblock), unblock.account_id, unblock.target_account.inbox_url)
  13. end
  14. def build_json(unblock)
  15. Oj.dump(serialize_payload(unblock, ActivityPub::UndoBlockSerializer))
  16. end
  17. end