activity_serializer.rb 500 B

12345678910111213141516171819202122
  1. # frozen_string_literal: true
  2. class ActivityPub::ActivitySerializer < ActivityPub::Serializer
  3. def self.serializer_for(model, options)
  4. case model.class.name
  5. when 'Status'
  6. ActivityPub::NoteSerializer
  7. when 'DeliverToDeviceService::EncryptedMessage'
  8. ActivityPub::EncryptedMessageSerializer
  9. else
  10. super
  11. end
  12. end
  13. attributes :id, :type, :actor, :published, :to, :cc
  14. has_one :virtual_object, key: :object
  15. def published
  16. object.published.iso8601
  17. end
  18. end