delete_serializer.rb 669 B

1234567891011121314151617181920212223242526272829303132333435
  1. # frozen_string_literal: true
  2. class ActivityPub::DeleteSerializer < ActiveModel::Serializer
  3. class TombstoneSerializer < ActiveModel::Serializer
  4. attributes :id, :type, :atom_uri
  5. def id
  6. ActivityPub::TagManager.instance.uri_for(object)
  7. end
  8. def type
  9. 'Tombstone'
  10. end
  11. def atom_uri
  12. OStatus::TagManager.instance.uri_for(object)
  13. end
  14. end
  15. attributes :id, :type, :actor
  16. has_one :object, serializer: TombstoneSerializer
  17. def id
  18. [ActivityPub::TagManager.instance.uri_for(object), '#delete'].join
  19. end
  20. def type
  21. 'Delete'
  22. end
  23. def actor
  24. ActivityPub::TagManager.instance.uri_for(object.account)
  25. end
  26. end