1
0
mirror of https://github.com/funamitech/mastodon synced 2024-11-28 06:48:45 +09:00
YuruToot/app/serializers/activitypub/activity_serializer.rb

23 lines
500 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class ActivityPub::ActivitySerializer < ActivityPub::Serializer
2020-06-03 02:24:53 +09:00
def self.serializer_for(model, options)
case model.class.name
when 'Status'
ActivityPub::NoteSerializer
when 'DeliverToDeviceService::EncryptedMessage'
ActivityPub::EncryptedMessageSerializer
else
super
end
end
2020-06-03 02:24:53 +09:00
attributes :id, :type, :actor, :published, :to, :cc
2020-06-03 02:24:53 +09:00
has_one :virtual_object, key: :object
def published
2020-06-03 02:24:53 +09:00
object.published.iso8601
end
end