You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mastodon/app/serializers/rest/context_serializer.rb

45 lines
835 B
Ruby

# frozen_string_literal: true
class REST::ContextSerializer < ActiveModel::Serializer
class DepthGapSerializer < ActiveModel::Serializer
attributes :more_under
def more_under
object.id.to_s
end
end
class LimitGapSerializer < ActiveModel::Serializer
attributes :more_after
def more_after
object.id.to_s
end
end
class FilterGapSerializer < ActiveModel::Serializer
attributes :filtered
def filtered
object.id.to_s
end
end
def self.serializer_for(model, options)
case model.class.name
when 'Status'
REST::StatusSerializer
when 'Context::DepthGap'
DepthGapSerializer
when 'Context::LimitGap'
LimitGapSerializer
when 'Context::FilterGap'
FilterGapSerializer
else
super
end
end
has_many :descendants
end