undo_announce_serializer.rb 605 B

123456789101112131415161718192021222324252627
  1. # frozen_string_literal: true
  2. class ActivityPub::UndoAnnounceSerializer < ActivityPub::Serializer
  3. attributes :id, :type, :actor, :to
  4. has_one :virtual_object, key: :object, serializer: ActivityPub::ActivitySerializer
  5. def id
  6. [ActivityPub::TagManager.instance.uri_for(object.account), '#announces/', object.id, '/undo'].join
  7. end
  8. def type
  9. 'Undo'
  10. end
  11. def actor
  12. ActivityPub::TagManager.instance.uri_for(object.account)
  13. end
  14. def to
  15. [ActivityPub::TagManager::COLLECTIONS[:public]]
  16. end
  17. def virtual_object
  18. ActivityPub::ActivityPresenter.from_status(object)
  19. end
  20. end