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
625 B

  1. # frozen_string_literal: true
  2. class ActivityPub::FlagSerializer < ActiveModel::Serializer
  3. attributes :id, :type, :actor, :content
  4. attribute :virtual_object, key: :object
  5. def id
  6. # This is nil for now
  7. ActivityPub::TagManager.instance.uri_for(object)
  8. end
  9. def type
  10. 'Flag'
  11. end
  12. def actor
  13. ActivityPub::TagManager.instance.uri_for(instance_options[:account] || object.account)
  14. end
  15. def virtual_object
  16. [ActivityPub::TagManager.instance.uri_for(object.target_account)] + object.statuses.map { |s| ActivityPub::TagManager.instance.uri_for(s) }
  17. end
  18. def content
  19. object.comment
  20. end
  21. end