mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-25 16:43:41 +01:00
a6328fc1b1
- Objects must have attributedTo instead of actor - The current attribute belongs to CollectionPage, not Collection
25 lines
473 B
Ruby
25 lines
473 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ActivityPub::CollectionSerializer < ActiveModel::Serializer
|
|
def self.serializer_for(model, options)
|
|
return ActivityPub::ActivitySerializer if model.class.name == 'Status'
|
|
super
|
|
end
|
|
|
|
attributes :id, :type, :total_items
|
|
|
|
has_many :items, key: :ordered_items
|
|
|
|
def type
|
|
case object.type
|
|
when :ordered
|
|
'OrderedCollection'
|
|
else
|
|
'Collection'
|
|
end
|
|
end
|
|
|
|
def total_items
|
|
object.size
|
|
end
|
|
end
|