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.

27 lines
573 B

  1. # frozen_string_literal: true
  2. class ActivityPub::ActivitySerializer < ActiveModel::Serializer
  3. attributes :id, :type, :actor, :to, :cc
  4. has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer
  5. def id
  6. [ActivityPub::TagManager.instance.uri_for(object), '/activity'].join
  7. end
  8. def type
  9. object.reblog? ? 'Announce' : 'Create'
  10. end
  11. def actor
  12. ActivityPub::TagManager.instance.uri_for(object.account)
  13. end
  14. def to
  15. ActivityPub::TagManager.instance.to(object)
  16. end
  17. def cc
  18. ActivityPub::TagManager.instance.cc(object)
  19. end
  20. end