1
0

unblock_service.rb 618 B

1234567891011121314151617181920212223
  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