delete_serializer.rb 776 B

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