outbox_serializer.rb 386 B

123456789101112131415
  1. # frozen_string_literal: true
  2. class ActivityPub::OutboxSerializer < ActivityPub::CollectionSerializer
  3. def self.serializer_for(model, options)
  4. if model.class.name == 'ActivityPub::ActivityPresenter'
  5. ActivityPub::ActivitySerializer
  6. else
  7. super
  8. end
  9. end
  10. def items
  11. object.items.map { |status| ActivityPub::ActivityPresenter.from_status(status) }
  12. end
  13. end