闭社主体 forked from https://github.com/tootsuite/mastodon
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.

39 lines
742 B

  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, :to
  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. def to
  27. [ActivityPub::TagManager::COLLECTIONS[:public]]
  28. end
  29. end